@wix/himalaya-cli 0.1722.0 → 0.1724.0
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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/godot/src/index.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/attendance-classifier.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-contract.d.ts +3 -39
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +10 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/index.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/preview-surfaces.d.ts +24 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-web-sdk.d.ts +37 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-web-sdk.generated.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/wrapped-app-link.d.ts +13 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-source.d.ts +2 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-order-backend.d.ts +0 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/attendance.d.ts +2 -8
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/index.d.ts +4 -13
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +175 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +46 -502
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +5 -26
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +64 -648
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/package-reader.js +4 -4
- package/dist/browser-plane/preview-deferred/{74e5b76ecf38392d7eb3f9a9512d60a0675de85d411c9c56293e123152b3f70b.bin → a6e25c06d2a17ab2b5e34bf2b5965fa3ddd76ce3da32a036e546a60938130d7b.bin} +1 -1
- package/dist/browser-plane/sw.js +9 -9
- package/dist/cli.mjs +1325 -422
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/himi-json-output.md +6 -2
- package/guides/iap-screen-adoption.md +4 -4
- package/guides/sdk-reference.json +11 -74
- package/guides/webview-page-sdk.md +14 -0
- package/guides/wix-business-context.md +24 -0
- package/guides/wix-site-to-himi-app.md +2 -1
- package/package.json +2 -2
- package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/beauty-salon-owner/config.ts +1 -1
- package/templates/branded-lite/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/branded-lite/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/brandy/README.md +14 -1
- package/templates/brandy/config.ts +71 -5
- package/templates/brandy/dev/index.ts +522 -8
- package/templates/brandy/himalaya.content.json +1 -1
- package/templates/brandy/himalaya.template.json +1 -1
- package/templates/brandy/tier5-src/himi-brandy-base44-account/index.ts +187 -0
- package/templates/community-club/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/community-club-owner/config.ts +1 -1
- package/templates/conference/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/events-meetups/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/events-meetups-owner/config.ts +1 -1
- package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/gym-fitness-owner/config.ts +1 -1
- package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/nonprofit-cause-owner/config.ts +1 -1
- package/templates/owner-lite/config.ts +1 -1
- package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/podcast-creator-owner/config.ts +1 -1
- package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/portfolio-creative-owner/config.ts +1 -1
- package/templates/restaurant/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/restaurant-owner/config.ts +1 -1
- package/templates/retail-store/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/retail-store/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/retail-store-owner/config.ts +1 -1
- package/templates/salon-spa/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/wholesale-store/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/yoga-studio-owner/config.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/attendance-orders.d.ts +0 -10
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/online-programs-orders.d.ts +0 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/pricing-plans-orders.d.ts +0 -2
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// himi-brandy-base44-account — the native Account screen of an app whose website is a Base44 site.
|
|
2
|
+
// Sign in (email + password, or an emailed code), register, reset a password, sign out,
|
|
3
|
+
// and — when the app provides the backend function — delete the account.
|
|
4
|
+
//
|
|
5
|
+
// Signing in here is what signs the WEBSITE tabs in: the native session bridge carries the
|
|
6
|
+
// token into every Base44 WebView (the token itself never reaches this worker — login answers
|
|
7
|
+
// `{ user }`). Signing out here signs every tab out and clears the site's storage.
|
|
8
|
+
//
|
|
9
|
+
// Account deletion (App Store 5.1.1(v)): a regular Base44 user cannot delete their own record —
|
|
10
|
+
// only the service role can — so it must run server-side. The contract names the app's backend
|
|
11
|
+
// function (`base44.deleteAccountFunction`), passed in as the onAppear `deleteFunction` param;
|
|
12
|
+
// without one the screen shows no Delete row rather than a button that cannot work.
|
|
13
|
+
|
|
14
|
+
import { defineService } from "@himalaya/state";
|
|
15
|
+
import { auth, functions, isBase44Error } from "@himalaya/base44";
|
|
16
|
+
|
|
17
|
+
interface AccountState {
|
|
18
|
+
signedIn: boolean;
|
|
19
|
+
user: string;
|
|
20
|
+
email: string;
|
|
21
|
+
password: string;
|
|
22
|
+
code: string;
|
|
23
|
+
/** "signIn" | "register" | "code" — which form the card shows. */
|
|
24
|
+
mode: string;
|
|
25
|
+
/** The app's delete-account function, "" when it has none (no Delete row). */
|
|
26
|
+
deleteFunction: string;
|
|
27
|
+
confirmingDelete: boolean;
|
|
28
|
+
busy: boolean;
|
|
29
|
+
/** Last thing that happened, painted on screen so a device drive can read it. */
|
|
30
|
+
message: string;
|
|
31
|
+
/** The last failure, painted in the error colour — "" when the last call succeeded. Kept apart
|
|
32
|
+
* from `message` so a failed sign-in never reads like progress. */
|
|
33
|
+
error: string;
|
|
34
|
+
// Derived visibility flags (hiddenWhen needs a boolean path).
|
|
35
|
+
hideSignedIn: boolean;
|
|
36
|
+
hideSignedOut: boolean;
|
|
37
|
+
hideCodeField: boolean;
|
|
38
|
+
hidePasswordField: boolean;
|
|
39
|
+
hideDelete: boolean;
|
|
40
|
+
hideConfirmDelete: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const describe = (e: unknown): string =>
|
|
44
|
+
isBase44Error(e) ? (e.message || e.code) : e instanceof Error ? e.message : String(e);
|
|
45
|
+
|
|
46
|
+
/** Recompute the hiddenWhen flags from the state that drives them. */
|
|
47
|
+
function derive(s: AccountState): AccountState {
|
|
48
|
+
return {
|
|
49
|
+
...s,
|
|
50
|
+
hideSignedIn: !s.signedIn,
|
|
51
|
+
hideSignedOut: s.signedIn,
|
|
52
|
+
hideCodeField: s.signedIn || s.mode !== "code",
|
|
53
|
+
hidePasswordField: s.signedIn || s.mode === "code",
|
|
54
|
+
hideDelete: !s.signedIn || !s.deleteFunction || s.confirmingDelete,
|
|
55
|
+
hideConfirmDelete: !s.signedIn || !s.deleteFunction || !s.confirmingDelete,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const acct = defineService<AccountState, {
|
|
60
|
+
open: (s: AccountState, p?: { deleteFunction?: string }) => AccountState;
|
|
61
|
+
setEmail: (s: AccountState, p?: { value?: string }) => AccountState;
|
|
62
|
+
setPassword: (s: AccountState, p?: { value?: string }) => AccountState;
|
|
63
|
+
setCode: (s: AccountState, p?: { value?: string }) => AccountState;
|
|
64
|
+
useCode: (s: AccountState) => AccountState;
|
|
65
|
+
usePassword: (s: AccountState) => AccountState;
|
|
66
|
+
signIn: (s: AccountState) => AccountState;
|
|
67
|
+
register: (s: AccountState) => AccountState;
|
|
68
|
+
sendCode: (s: AccountState) => AccountState;
|
|
69
|
+
verifyCode: (s: AccountState) => AccountState;
|
|
70
|
+
resetPassword: (s: AccountState) => AccountState;
|
|
71
|
+
signOut: (s: AccountState) => AccountState;
|
|
72
|
+
askDelete: (s: AccountState) => AccountState;
|
|
73
|
+
cancelDelete: (s: AccountState) => AccountState;
|
|
74
|
+
confirmDelete: (s: AccountState) => AccountState;
|
|
75
|
+
_signedIn: (s: AccountState, user?: string, message?: string) => AccountState;
|
|
76
|
+
_signedOut: (s: AccountState, message?: string) => AccountState;
|
|
77
|
+
_done: (s: AccountState, message?: string) => AccountState;
|
|
78
|
+
_failed: (s: AccountState, error?: string) => AccountState;
|
|
79
|
+
_failedRegister: (s: AccountState, message?: string) => AccountState;
|
|
80
|
+
}>("himiBase44Account", {
|
|
81
|
+
state: derive({
|
|
82
|
+
signedIn: false,
|
|
83
|
+
user: "",
|
|
84
|
+
email: "",
|
|
85
|
+
password: "",
|
|
86
|
+
code: "",
|
|
87
|
+
mode: "signIn",
|
|
88
|
+
deleteFunction: "",
|
|
89
|
+
confirmingDelete: false,
|
|
90
|
+
busy: false,
|
|
91
|
+
message: "",
|
|
92
|
+
error: "",
|
|
93
|
+
hideSignedIn: true,
|
|
94
|
+
hideSignedOut: false,
|
|
95
|
+
hideCodeField: true,
|
|
96
|
+
hidePasswordField: false,
|
|
97
|
+
hideDelete: true,
|
|
98
|
+
hideConfirmDelete: true,
|
|
99
|
+
}),
|
|
100
|
+
actions: {
|
|
101
|
+
open: (s, p) => {
|
|
102
|
+
auth.status()
|
|
103
|
+
.then((st) => (st.signedIn ? acct._signedIn(String(st.user?.email ?? ""), "") : acct._signedOut("")))
|
|
104
|
+
.catch((e) => acct._failed(describe(e)));
|
|
105
|
+
return derive({ ...s, deleteFunction: String(p?.deleteFunction ?? "") });
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
setEmail: (s, p) => ({ ...s, email: String(p?.value ?? "") }),
|
|
109
|
+
setPassword: (s, p) => ({ ...s, password: String(p?.value ?? "") }),
|
|
110
|
+
setCode: (s, p) => ({ ...s, code: String(p?.value ?? "") }),
|
|
111
|
+
useCode: (s) => derive({ ...s, mode: "code", message: "" }),
|
|
112
|
+
usePassword: (s) => derive({ ...s, mode: "signIn", message: "" }),
|
|
113
|
+
|
|
114
|
+
signIn: (s) => {
|
|
115
|
+
if (!s.email || !s.password) return { ...s, error: "", message: "Enter your email and password." };
|
|
116
|
+
auth.loginViaEmailPassword(s.email, s.password)
|
|
117
|
+
.then(({ user }) => acct._signedIn(String(user?.email ?? s.email), "Signed in."))
|
|
118
|
+
.catch((e) => acct._failed(describe(e)));
|
|
119
|
+
return { ...s, password: "", busy: true, error: "", message: "Signing in…" };
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
register: (s) => {
|
|
123
|
+
if (!s.email || !s.password) return { ...s, error: "", message: "Enter an email and a password to create an account." };
|
|
124
|
+
auth.register(s.email, s.password)
|
|
125
|
+
.then(() => acct._done("Check your email for a code to finish creating your account."))
|
|
126
|
+
// Back to the password form: the code form hides the fields a retry needs.
|
|
127
|
+
.catch((e) => acct._failedRegister(describe(e)));
|
|
128
|
+
return derive({ ...s, password: "", mode: "code", busy: true, error: "", message: "Creating your account…" });
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
sendCode: (s) => {
|
|
132
|
+
if (!s.email) return { ...s, error: "", message: "Enter your email first." };
|
|
133
|
+
auth.loginViaOtp(s.email)
|
|
134
|
+
.then(() => acct._done("We emailed you a code."))
|
|
135
|
+
.catch((e) => acct._failed(describe(e)));
|
|
136
|
+
return derive({ ...s, mode: "code", busy: true, error: "", message: "Sending a code…" });
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
verifyCode: (s) => {
|
|
140
|
+
if (!s.email || !s.code) return { ...s, error: "", message: "Enter your email and the code." };
|
|
141
|
+
auth.verifyOtp(s.email, s.code)
|
|
142
|
+
.then(({ user }) => acct._signedIn(String(user?.email ?? s.email), "Signed in."))
|
|
143
|
+
.catch((e) => acct._failed(describe(e)));
|
|
144
|
+
return { ...s, code: "", busy: true, error: "", message: "Checking the code…" };
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
resetPassword: (s) => {
|
|
148
|
+
if (!s.email) return { ...s, error: "", message: "Enter your email first." };
|
|
149
|
+
auth.resetPassword(s.email)
|
|
150
|
+
.then(() => acct._done("If that email has an account, a reset link is on its way."))
|
|
151
|
+
.catch((e) => acct._failed(describe(e)));
|
|
152
|
+
return { ...s, busy: true, error: "", message: "Sending a reset link…" };
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
signOut: (s) => {
|
|
156
|
+
auth.logout()
|
|
157
|
+
.then(() => acct._signedOut("Signed out."))
|
|
158
|
+
.catch((e) => acct._failed(describe(e)));
|
|
159
|
+
return { ...s, busy: true, error: "", message: "Signing out…" };
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
askDelete: (s) => derive({ ...s, confirmingDelete: true, message: "" }),
|
|
163
|
+
cancelDelete: (s) => derive({ ...s, confirmingDelete: false }),
|
|
164
|
+
|
|
165
|
+
confirmDelete: (s) => {
|
|
166
|
+
if (!s.deleteFunction) return s;
|
|
167
|
+
functions.invoke(s.deleteFunction)
|
|
168
|
+
.then(
|
|
169
|
+
// Deleted. The sign-out that follows can fail on its own (network) — the account is gone
|
|
170
|
+
// either way, so never report it as "could not delete" and invite a retry that fails.
|
|
171
|
+
() => auth.logout().catch(() => undefined).then(() => acct._signedOut("Your account was deleted.")),
|
|
172
|
+
(e) => acct._failed(`Could not delete the account: ${describe(e)}`),
|
|
173
|
+
);
|
|
174
|
+
return { ...s, busy: true, error: "", message: "Deleting your account…" };
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
_signedIn: (s, user, message) =>
|
|
178
|
+
derive({ ...s, error: "", signedIn: true, user: String(user ?? ""), busy: false, confirmingDelete: false, message: String(message ?? "") }),
|
|
179
|
+
_signedOut: (s, message) =>
|
|
180
|
+
derive({ ...s, error: "", signedIn: false, user: "", busy: false, confirmingDelete: false, mode: "signIn", message: String(message ?? "") }),
|
|
181
|
+
_done: (s, message) => ({ ...s, busy: false, error: "", message: String(message ?? "") }),
|
|
182
|
+
_failed: (s, error) => ({ ...s, busy: false, message: "", error: String(error ?? "") }),
|
|
183
|
+
_failedRegister: (s, error) => derive({ ...s, busy: false, mode: "signIn", message: "", error: String(error ?? "") }),
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
export default acct;
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -2,7 +2,7 @@ import { withOnlineWrites, offlineWritesEnabled, offlineWriteMessage } from "../
|
|
|
2
2
|
import { defineService as registerState } from "@himalaya/state";
|
|
3
3
|
// Tier-5 bundle: himi-store — product detail.
|
|
4
4
|
import { withIapPresentation } from "../_shared/iap-presentation.js";
|
|
5
|
-
import {
|
|
5
|
+
import { storesProductOrders, type IapCommerce, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
6
6
|
import { iapPriceCopy, iapPurchaseCopy } from "../_shared/iap-worker.js";
|
|
7
7
|
import { share as shareSheet } from "@himalaya/share";
|
|
8
8
|
import { addToCurrentCart, getCurrentCart } from "@himalaya/wix-ecom";
|
|
@@ -466,10 +466,8 @@ function derive(s: S): S {
|
|
|
466
466
|
// read answering late — must not replace the badge the add set (#3468 review).
|
|
467
467
|
let cartBadgeEpoch = 0;
|
|
468
468
|
|
|
469
|
-
// A digital product with no options sells through the App Store
|
|
470
|
-
//
|
|
471
|
-
// Until then, and for any other product, an App Store route only blocks the regular checkout.
|
|
472
|
-
const SELLS_THROUGH_APPLE = storesAppleSalesEnabled();
|
|
469
|
+
// A digital product with no options sells through the App Store: wix-iap StartItemPayment places and
|
|
470
|
+
// charges its order. For any other product, an App Store route only blocks the regular checkout.
|
|
473
471
|
const WIX_STORES_APP = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
|
|
474
472
|
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
475
473
|
|
|
@@ -477,7 +475,7 @@ let productPricing: IapCommerce;
|
|
|
477
475
|
let checkoutEntered = false;
|
|
478
476
|
const defineService = withIapPresentation<S>({
|
|
479
477
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
480
|
-
adapters:
|
|
478
|
+
adapters: [storesProductOrders],
|
|
481
479
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
482
480
|
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "paintCached"], concurrentPublishActions: ["buy"],
|
|
483
481
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
@@ -508,7 +506,7 @@ const defineService = withIapPresentation<S>({
|
|
|
508
506
|
function applePurchase(state: S): IapPurchaseFields {
|
|
509
507
|
const id = inputId();
|
|
510
508
|
const loaded = !!id && lastLoadedId === id;
|
|
511
|
-
const sellable =
|
|
509
|
+
const sellable = loaded && lastProduct?.productType?.toLowerCase() === "digital" && !state.optionsUnknown && state.optionGroups.length === 0;
|
|
512
510
|
const copy = iapPurchaseCopy("product");
|
|
513
511
|
const fields = sellable ? productPricing.purchaseFields({ kind: "storesProduct", id }, copy) : NOT_APPLE;
|
|
514
512
|
return fields.appleRoute ? fields : NOT_APPLE;
|
|
@@ -516,7 +514,6 @@ function applePurchase(state: S): IapPurchaseFields {
|
|
|
516
514
|
|
|
517
515
|
/** On every entry: the first starts the checkout (recovering held purchases), later ones reconcile. */
|
|
518
516
|
function enterCheckout(): void {
|
|
519
|
-
if (!SELLS_THROUGH_APPLE) return;
|
|
520
517
|
void (checkoutEntered ? productPricing.reconcile() : productPricing.start());
|
|
521
518
|
checkoutEntered = true;
|
|
522
519
|
}
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -2,7 +2,7 @@ import { withOnlineWrites, offlineWritesEnabled, offlineWriteMessage } from "../
|
|
|
2
2
|
import { defineService as registerState } from "@himalaya/state";
|
|
3
3
|
// Tier-5 bundle: himi-store — product detail.
|
|
4
4
|
import { withIapPresentation } from "../_shared/iap-presentation.js";
|
|
5
|
-
import {
|
|
5
|
+
import { storesProductOrders, type IapCommerce, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
6
6
|
import { iapPriceCopy, iapPurchaseCopy } from "../_shared/iap-worker.js";
|
|
7
7
|
import { share as shareSheet } from "@himalaya/share";
|
|
8
8
|
import { addToCurrentCart, getCurrentCart } from "@himalaya/wix-ecom";
|
|
@@ -466,10 +466,8 @@ function derive(s: S): S {
|
|
|
466
466
|
// read answering late — must not replace the badge the add set (#3468 review).
|
|
467
467
|
let cartBadgeEpoch = 0;
|
|
468
468
|
|
|
469
|
-
// A digital product with no options sells through the App Store
|
|
470
|
-
//
|
|
471
|
-
// Until then, and for any other product, an App Store route only blocks the regular checkout.
|
|
472
|
-
const SELLS_THROUGH_APPLE = storesAppleSalesEnabled();
|
|
469
|
+
// A digital product with no options sells through the App Store: wix-iap StartItemPayment places and
|
|
470
|
+
// charges its order. For any other product, an App Store route only blocks the regular checkout.
|
|
473
471
|
const WIX_STORES_APP = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
|
|
474
472
|
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
475
473
|
|
|
@@ -477,7 +475,7 @@ let productPricing: IapCommerce;
|
|
|
477
475
|
let checkoutEntered = false;
|
|
478
476
|
const defineService = withIapPresentation<S>({
|
|
479
477
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
480
|
-
adapters:
|
|
478
|
+
adapters: [storesProductOrders],
|
|
481
479
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
482
480
|
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "paintCached"], concurrentPublishActions: ["buy"],
|
|
483
481
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
@@ -508,7 +506,7 @@ const defineService = withIapPresentation<S>({
|
|
|
508
506
|
function applePurchase(state: S): IapPurchaseFields {
|
|
509
507
|
const id = inputId();
|
|
510
508
|
const loaded = !!id && lastLoadedId === id;
|
|
511
|
-
const sellable =
|
|
509
|
+
const sellable = loaded && lastProduct?.productType?.toLowerCase() === "digital" && !state.optionsUnknown && state.optionGroups.length === 0;
|
|
512
510
|
const copy = iapPurchaseCopy("product");
|
|
513
511
|
const fields = sellable ? productPricing.purchaseFields({ kind: "storesProduct", id }, copy) : NOT_APPLE;
|
|
514
512
|
return fields.appleRoute ? fields : NOT_APPLE;
|
|
@@ -516,7 +514,6 @@ function applePurchase(state: S): IapPurchaseFields {
|
|
|
516
514
|
|
|
517
515
|
/** On every entry: the first starts the checkout (recovering held purchases), later ones reconcile. */
|
|
518
516
|
function enterCheckout(): void {
|
|
519
|
-
if (!SELLS_THROUGH_APPLE) return;
|
|
520
517
|
void (checkoutEntered ? productPricing.reconcile() : productPricing.start());
|
|
521
518
|
checkoutEntered = true;
|
|
522
519
|
}
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -3,7 +3,7 @@ import { withOnlineWrites, offlineWritesEnabled, offlineWriteMessage } from "../
|
|
|
3
3
|
import { defineService as registerState } from "@himalaya/state";
|
|
4
4
|
// Tier-5 bundle: himi-store — product detail.
|
|
5
5
|
import { withIapPresentation } from "../_shared/iap-presentation.js";
|
|
6
|
-
import {
|
|
6
|
+
import { storesProductOrders, type IapCommerce, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
7
7
|
import { iapPriceCopy, iapPurchaseCopy } from "../_shared/iap-worker.js";
|
|
8
8
|
import { share as shareSheet } from "@himalaya/share";
|
|
9
9
|
import { addToCurrentCart, getCurrentCart } from "@himalaya/wix-ecom";
|
|
@@ -451,10 +451,8 @@ function derive(s: S): S {
|
|
|
451
451
|
// read answering late — must not replace the badge the add set (#3468 review).
|
|
452
452
|
let cartBadgeEpoch = 0;
|
|
453
453
|
|
|
454
|
-
// A digital product with no options sells through the App Store
|
|
455
|
-
//
|
|
456
|
-
// Until then, and for any other product, an App Store route only blocks the regular checkout.
|
|
457
|
-
const SELLS_THROUGH_APPLE = storesAppleSalesEnabled();
|
|
454
|
+
// A digital product with no options sells through the App Store: wix-iap StartItemPayment places and
|
|
455
|
+
// charges its order. For any other product, an App Store route only blocks the regular checkout.
|
|
458
456
|
const WIX_STORES_APP = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
|
|
459
457
|
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
460
458
|
|
|
@@ -462,7 +460,7 @@ let productPricing: IapCommerce;
|
|
|
462
460
|
let checkoutEntered = false;
|
|
463
461
|
const registerProduct = withIapPresentation<S>({
|
|
464
462
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
465
|
-
adapters:
|
|
463
|
+
adapters: [storesProductOrders],
|
|
466
464
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
467
465
|
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "readChanged"], concurrentPublishActions: ["buy"],
|
|
468
466
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
@@ -513,7 +511,7 @@ const defineService = withReadLifecycle(registerProduct, "load", {
|
|
|
513
511
|
function applePurchase(state: S): IapPurchaseFields {
|
|
514
512
|
const id = inputId();
|
|
515
513
|
const loaded = !!id && lastLoadedId === id;
|
|
516
|
-
const sellable =
|
|
514
|
+
const sellable = loaded && lastProduct?.productType?.toLowerCase() === "digital" && !state.optionsUnknown && state.optionGroups.length === 0;
|
|
517
515
|
const copy = iapPurchaseCopy("product");
|
|
518
516
|
const fields = sellable ? productPricing.purchaseFields({ kind: "storesProduct", id }, copy) : NOT_APPLE;
|
|
519
517
|
return fields.appleRoute ? fields : NOT_APPLE;
|
|
@@ -521,7 +519,6 @@ function applePurchase(state: S): IapPurchaseFields {
|
|
|
521
519
|
|
|
522
520
|
/** On every entry: the first starts the checkout (recovering held purchases), later ones reconcile. */
|
|
523
521
|
function enterCheckout(): void {
|
|
524
|
-
if (!SELLS_THROUGH_APPLE) return;
|
|
525
522
|
void (checkoutEntered ? productPricing.reconcile() : productPricing.start());
|
|
526
523
|
checkoutEntered = true;
|
|
527
524
|
}
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","
|
|
40
|
+
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","wix_api","stream"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
42
|
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
43
|
splash: {
|