@wix/himalaya-cli 0.2047.0 → 0.2049.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/sdk/iap/src/index.d.ts +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/monitoring.d.ts +81 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +7 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-monitoring.d.ts +23 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +530 -68
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +198 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +532 -70
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +1 -1
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{bfa6093b86d3106ef891a717dc0da1b1c0d9d1a456259753c25398bbafbcef8e.bin → 78e9187a8551e2a63e7bc9f5cda8449c6a39ba3d9bcfa40947713322e68a3e3b.bin} +1 -1
- package/dist/browser-plane/sw.js +7 -7
- package/dist/cli.mjs +51 -47
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/sdk-reference.json +121 -2
- package/package.json +2 -2
- package/templates/beauty-salon/l10n/ar.json +6 -0
- package/templates/beauty-salon/l10n/cs.json +6 -0
- package/templates/beauty-salon/l10n/da.json +6 -0
- package/templates/beauty-salon/l10n/de.json +6 -0
- package/templates/beauty-salon/l10n/el.json +6 -0
- package/templates/beauty-salon/l10n/en.json +6 -0
- package/templates/beauty-salon/l10n/es.json +6 -0
- package/templates/beauty-salon/l10n/fi.json +6 -0
- package/templates/beauty-salon/l10n/fr.json +6 -0
- package/templates/beauty-salon/l10n/he.json +5 -0
- package/templates/beauty-salon/l10n/hu.json +6 -0
- package/templates/beauty-salon/l10n/id.json +6 -0
- package/templates/beauty-salon/l10n/it.json +6 -0
- package/templates/beauty-salon/l10n/ja.json +6 -0
- package/templates/beauty-salon/l10n/ko.json +6 -0
- package/templates/beauty-salon/l10n/lt.json +6 -0
- package/templates/beauty-salon/l10n/nl.json +6 -0
- package/templates/beauty-salon/l10n/no.json +6 -0
- package/templates/beauty-salon/l10n/pl.json +6 -0
- package/templates/beauty-salon/l10n/pt.json +6 -0
- package/templates/beauty-salon/l10n/ru.json +6 -0
- package/templates/beauty-salon/l10n/sv.json +6 -0
- package/templates/beauty-salon/l10n/th.json +6 -0
- package/templates/beauty-salon/l10n/tr.json +6 -0
- package/templates/beauty-salon/l10n/uk.json +6 -0
- package/templates/beauty-salon/l10n/vi.json +6 -0
- package/templates/beauty-salon/l10n/zh.json +6 -0
- package/templates/beauty-salon/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/branded-lite/recipes/announcement-card.json +85 -34
- package/templates/branded-lite/tier5-src/_shared/announcement-section.ts +52 -10
- package/templates/branded-lite/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/community-club/l10n/ar.json +6 -0
- package/templates/community-club/l10n/cs.json +6 -0
- package/templates/community-club/l10n/da.json +6 -0
- package/templates/community-club/l10n/de.json +6 -0
- package/templates/community-club/l10n/el.json +6 -0
- package/templates/community-club/l10n/en.json +6 -0
- package/templates/community-club/l10n/es.json +6 -0
- package/templates/community-club/l10n/fi.json +6 -0
- package/templates/community-club/l10n/fr.json +6 -0
- package/templates/community-club/l10n/he.json +5 -0
- package/templates/community-club/l10n/hu.json +6 -0
- package/templates/community-club/l10n/id.json +6 -0
- package/templates/community-club/l10n/it.json +6 -0
- package/templates/community-club/l10n/ja.json +6 -0
- package/templates/community-club/l10n/ko.json +6 -0
- package/templates/community-club/l10n/lt.json +6 -0
- package/templates/community-club/l10n/nl.json +6 -0
- package/templates/community-club/l10n/no.json +6 -0
- package/templates/community-club/l10n/pl.json +6 -0
- package/templates/community-club/l10n/pt.json +6 -0
- package/templates/community-club/l10n/ru.json +6 -0
- package/templates/community-club/l10n/sv.json +6 -0
- package/templates/community-club/l10n/th.json +6 -0
- package/templates/community-club/l10n/tr.json +6 -0
- package/templates/community-club/l10n/uk.json +6 -0
- package/templates/community-club/l10n/vi.json +6 -0
- package/templates/community-club/l10n/zh.json +6 -0
- package/templates/community-club/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/events-meetups/l10n/ar.json +6 -0
- package/templates/events-meetups/l10n/cs.json +6 -0
- package/templates/events-meetups/l10n/da.json +6 -0
- package/templates/events-meetups/l10n/de.json +6 -0
- package/templates/events-meetups/l10n/el.json +6 -0
- package/templates/events-meetups/l10n/en.json +6 -0
- package/templates/events-meetups/l10n/es.json +6 -0
- package/templates/events-meetups/l10n/fi.json +6 -0
- package/templates/events-meetups/l10n/fr.json +6 -0
- package/templates/events-meetups/l10n/he.json +5 -0
- package/templates/events-meetups/l10n/hu.json +6 -0
- package/templates/events-meetups/l10n/id.json +6 -0
- package/templates/events-meetups/l10n/it.json +6 -0
- package/templates/events-meetups/l10n/ja.json +6 -0
- package/templates/events-meetups/l10n/ko.json +6 -0
- package/templates/events-meetups/l10n/lt.json +6 -0
- package/templates/events-meetups/l10n/nl.json +6 -0
- package/templates/events-meetups/l10n/no.json +6 -0
- package/templates/events-meetups/l10n/pl.json +6 -0
- package/templates/events-meetups/l10n/pt.json +6 -0
- package/templates/events-meetups/l10n/ru.json +6 -0
- package/templates/events-meetups/l10n/sv.json +6 -0
- package/templates/events-meetups/l10n/th.json +6 -0
- package/templates/events-meetups/l10n/tr.json +6 -0
- package/templates/events-meetups/l10n/uk.json +6 -0
- package/templates/events-meetups/l10n/vi.json +6 -0
- package/templates/events-meetups/l10n/zh.json +6 -0
- package/templates/events-meetups/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/gym-fitness/l10n/ar.json +6 -0
- package/templates/gym-fitness/l10n/cs.json +6 -0
- package/templates/gym-fitness/l10n/da.json +6 -0
- package/templates/gym-fitness/l10n/de.json +6 -0
- package/templates/gym-fitness/l10n/el.json +6 -0
- package/templates/gym-fitness/l10n/en.json +6 -0
- package/templates/gym-fitness/l10n/es.json +6 -0
- package/templates/gym-fitness/l10n/fi.json +6 -0
- package/templates/gym-fitness/l10n/fr.json +6 -0
- package/templates/gym-fitness/l10n/he.json +5 -0
- package/templates/gym-fitness/l10n/hu.json +6 -0
- package/templates/gym-fitness/l10n/id.json +6 -0
- package/templates/gym-fitness/l10n/it.json +6 -0
- package/templates/gym-fitness/l10n/ja.json +6 -0
- package/templates/gym-fitness/l10n/ko.json +6 -0
- package/templates/gym-fitness/l10n/lt.json +6 -0
- package/templates/gym-fitness/l10n/nl.json +6 -0
- package/templates/gym-fitness/l10n/no.json +6 -0
- package/templates/gym-fitness/l10n/pl.json +6 -0
- package/templates/gym-fitness/l10n/pt.json +6 -0
- package/templates/gym-fitness/l10n/ru.json +6 -0
- package/templates/gym-fitness/l10n/sv.json +6 -0
- package/templates/gym-fitness/l10n/th.json +6 -0
- package/templates/gym-fitness/l10n/tr.json +6 -0
- package/templates/gym-fitness/l10n/uk.json +6 -0
- package/templates/gym-fitness/l10n/vi.json +6 -0
- package/templates/gym-fitness/l10n/zh.json +6 -0
- package/templates/gym-fitness/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/nonprofit-cause/l10n/ar.json +6 -0
- package/templates/nonprofit-cause/l10n/cs.json +6 -0
- package/templates/nonprofit-cause/l10n/da.json +6 -0
- package/templates/nonprofit-cause/l10n/de.json +6 -0
- package/templates/nonprofit-cause/l10n/el.json +6 -0
- package/templates/nonprofit-cause/l10n/en.json +6 -0
- package/templates/nonprofit-cause/l10n/es.json +6 -0
- package/templates/nonprofit-cause/l10n/fi.json +6 -0
- package/templates/nonprofit-cause/l10n/fr.json +6 -0
- package/templates/nonprofit-cause/l10n/he.json +5 -0
- package/templates/nonprofit-cause/l10n/hu.json +6 -0
- package/templates/nonprofit-cause/l10n/id.json +6 -0
- package/templates/nonprofit-cause/l10n/it.json +6 -0
- package/templates/nonprofit-cause/l10n/ja.json +6 -0
- package/templates/nonprofit-cause/l10n/ko.json +6 -0
- package/templates/nonprofit-cause/l10n/lt.json +6 -0
- package/templates/nonprofit-cause/l10n/nl.json +6 -0
- package/templates/nonprofit-cause/l10n/no.json +6 -0
- package/templates/nonprofit-cause/l10n/pl.json +6 -0
- package/templates/nonprofit-cause/l10n/pt.json +6 -0
- package/templates/nonprofit-cause/l10n/ru.json +6 -0
- package/templates/nonprofit-cause/l10n/sv.json +6 -0
- package/templates/nonprofit-cause/l10n/th.json +6 -0
- package/templates/nonprofit-cause/l10n/tr.json +6 -0
- package/templates/nonprofit-cause/l10n/uk.json +6 -0
- package/templates/nonprofit-cause/l10n/vi.json +6 -0
- package/templates/nonprofit-cause/l10n/zh.json +6 -0
- package/templates/nonprofit-cause/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/podcast-creator/l10n/ar.json +6 -0
- package/templates/podcast-creator/l10n/cs.json +6 -0
- package/templates/podcast-creator/l10n/da.json +6 -0
- package/templates/podcast-creator/l10n/de.json +6 -0
- package/templates/podcast-creator/l10n/el.json +6 -0
- package/templates/podcast-creator/l10n/en.json +6 -0
- package/templates/podcast-creator/l10n/es.json +6 -0
- package/templates/podcast-creator/l10n/fi.json +6 -0
- package/templates/podcast-creator/l10n/fr.json +6 -0
- package/templates/podcast-creator/l10n/he.json +5 -0
- package/templates/podcast-creator/l10n/hu.json +6 -0
- package/templates/podcast-creator/l10n/id.json +6 -0
- package/templates/podcast-creator/l10n/it.json +6 -0
- package/templates/podcast-creator/l10n/ja.json +6 -0
- package/templates/podcast-creator/l10n/ko.json +6 -0
- package/templates/podcast-creator/l10n/lt.json +6 -0
- package/templates/podcast-creator/l10n/nl.json +6 -0
- package/templates/podcast-creator/l10n/no.json +6 -0
- package/templates/podcast-creator/l10n/pl.json +6 -0
- package/templates/podcast-creator/l10n/pt.json +6 -0
- package/templates/podcast-creator/l10n/ru.json +6 -0
- package/templates/podcast-creator/l10n/sv.json +6 -0
- package/templates/podcast-creator/l10n/th.json +6 -0
- package/templates/podcast-creator/l10n/tr.json +6 -0
- package/templates/podcast-creator/l10n/uk.json +6 -0
- package/templates/podcast-creator/l10n/vi.json +6 -0
- package/templates/podcast-creator/l10n/zh.json +6 -0
- package/templates/podcast-creator/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/portfolio-creative/l10n/ar.json +6 -0
- package/templates/portfolio-creative/l10n/cs.json +6 -0
- package/templates/portfolio-creative/l10n/da.json +6 -0
- package/templates/portfolio-creative/l10n/de.json +6 -0
- package/templates/portfolio-creative/l10n/el.json +6 -0
- package/templates/portfolio-creative/l10n/en.json +6 -0
- package/templates/portfolio-creative/l10n/es.json +6 -0
- package/templates/portfolio-creative/l10n/fi.json +6 -0
- package/templates/portfolio-creative/l10n/fr.json +6 -0
- package/templates/portfolio-creative/l10n/he.json +5 -0
- package/templates/portfolio-creative/l10n/hu.json +6 -0
- package/templates/portfolio-creative/l10n/id.json +6 -0
- package/templates/portfolio-creative/l10n/it.json +6 -0
- package/templates/portfolio-creative/l10n/ja.json +6 -0
- package/templates/portfolio-creative/l10n/ko.json +6 -0
- package/templates/portfolio-creative/l10n/lt.json +6 -0
- package/templates/portfolio-creative/l10n/nl.json +6 -0
- package/templates/portfolio-creative/l10n/no.json +6 -0
- package/templates/portfolio-creative/l10n/pl.json +6 -0
- package/templates/portfolio-creative/l10n/pt.json +6 -0
- package/templates/portfolio-creative/l10n/ru.json +6 -0
- package/templates/portfolio-creative/l10n/sv.json +6 -0
- package/templates/portfolio-creative/l10n/th.json +6 -0
- package/templates/portfolio-creative/l10n/tr.json +6 -0
- package/templates/portfolio-creative/l10n/uk.json +6 -0
- package/templates/portfolio-creative/l10n/vi.json +6 -0
- package/templates/portfolio-creative/l10n/zh.json +6 -0
- package/templates/portfolio-creative/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/professional-services/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/restaurant/l10n/ar.json +6 -0
- package/templates/restaurant/l10n/cs.json +6 -0
- package/templates/restaurant/l10n/da.json +6 -0
- package/templates/restaurant/l10n/de.json +6 -0
- package/templates/restaurant/l10n/el.json +6 -0
- package/templates/restaurant/l10n/en.json +6 -0
- package/templates/restaurant/l10n/es.json +6 -0
- package/templates/restaurant/l10n/fi.json +6 -0
- package/templates/restaurant/l10n/fr.json +6 -0
- package/templates/restaurant/l10n/he.json +5 -0
- package/templates/restaurant/l10n/hu.json +6 -0
- package/templates/restaurant/l10n/id.json +6 -0
- package/templates/restaurant/l10n/it.json +6 -0
- package/templates/restaurant/l10n/ja.json +6 -0
- package/templates/restaurant/l10n/ko.json +6 -0
- package/templates/restaurant/l10n/lt.json +6 -0
- package/templates/restaurant/l10n/nl.json +6 -0
- package/templates/restaurant/l10n/no.json +6 -0
- package/templates/restaurant/l10n/pl.json +6 -0
- package/templates/restaurant/l10n/pt.json +6 -0
- package/templates/restaurant/l10n/ru.json +6 -0
- package/templates/restaurant/l10n/sv.json +6 -0
- package/templates/restaurant/l10n/th.json +6 -0
- package/templates/restaurant/l10n/tr.json +6 -0
- package/templates/restaurant/l10n/uk.json +6 -0
- package/templates/restaurant/l10n/vi.json +6 -0
- package/templates/restaurant/l10n/zh.json +6 -0
- package/templates/restaurant/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/retail-store/l10n/ar.json +6 -0
- package/templates/retail-store/l10n/cs.json +6 -0
- package/templates/retail-store/l10n/da.json +6 -0
- package/templates/retail-store/l10n/de.json +6 -0
- package/templates/retail-store/l10n/el.json +6 -0
- package/templates/retail-store/l10n/en.json +6 -0
- package/templates/retail-store/l10n/es.json +6 -0
- package/templates/retail-store/l10n/fi.json +6 -0
- package/templates/retail-store/l10n/fr.json +6 -0
- package/templates/retail-store/l10n/he.json +5 -0
- package/templates/retail-store/l10n/hu.json +6 -0
- package/templates/retail-store/l10n/id.json +6 -0
- package/templates/retail-store/l10n/it.json +6 -0
- package/templates/retail-store/l10n/ja.json +6 -0
- package/templates/retail-store/l10n/ko.json +6 -0
- package/templates/retail-store/l10n/lt.json +6 -0
- package/templates/retail-store/l10n/nl.json +6 -0
- package/templates/retail-store/l10n/no.json +6 -0
- package/templates/retail-store/l10n/pl.json +6 -0
- package/templates/retail-store/l10n/pt.json +6 -0
- package/templates/retail-store/l10n/ru.json +6 -0
- package/templates/retail-store/l10n/sv.json +6 -0
- package/templates/retail-store/l10n/th.json +6 -0
- package/templates/retail-store/l10n/tr.json +6 -0
- package/templates/retail-store/l10n/uk.json +6 -0
- package/templates/retail-store/l10n/vi.json +6 -0
- package/templates/retail-store/l10n/zh.json +6 -0
- package/templates/retail-store/tier5-src/_shared/relative-time.ts +35 -2
- package/templates/yoga-studio/l10n/ar.json +6 -0
- package/templates/yoga-studio/l10n/cs.json +6 -0
- package/templates/yoga-studio/l10n/da.json +6 -0
- package/templates/yoga-studio/l10n/de.json +6 -0
- package/templates/yoga-studio/l10n/el.json +6 -0
- package/templates/yoga-studio/l10n/en.json +6 -0
- package/templates/yoga-studio/l10n/es.json +6 -0
- package/templates/yoga-studio/l10n/fi.json +6 -0
- package/templates/yoga-studio/l10n/fr.json +6 -0
- package/templates/yoga-studio/l10n/he.json +5 -0
- package/templates/yoga-studio/l10n/hu.json +6 -0
- package/templates/yoga-studio/l10n/id.json +6 -0
- package/templates/yoga-studio/l10n/it.json +6 -0
- package/templates/yoga-studio/l10n/ja.json +6 -0
- package/templates/yoga-studio/l10n/ko.json +6 -0
- package/templates/yoga-studio/l10n/lt.json +6 -0
- package/templates/yoga-studio/l10n/nl.json +6 -0
- package/templates/yoga-studio/l10n/no.json +6 -0
- package/templates/yoga-studio/l10n/pl.json +6 -0
- package/templates/yoga-studio/l10n/pt.json +6 -0
- package/templates/yoga-studio/l10n/ru.json +6 -0
- package/templates/yoga-studio/l10n/sv.json +6 -0
- package/templates/yoga-studio/l10n/th.json +6 -0
- package/templates/yoga-studio/l10n/tr.json +6 -0
- package/templates/yoga-studio/l10n/uk.json +6 -0
- package/templates/yoga-studio/l10n/vi.json +6 -0
- package/templates/yoga-studio/l10n/zh.json +6 -0
- package/templates/yoga-studio/tier5-src/_shared/relative-time.ts +35 -2
|
@@ -1574,6 +1574,192 @@ var numeric = (value) => typeof value === "number" ? value : void 0;
|
|
|
1574
1574
|
var boolean = (value) => typeof value === "boolean" ? value : void 0;
|
|
1575
1575
|
var zeroPrice = (value) => typeof value === "string" && /^0+(?:\.0+)?$/.test(value);
|
|
1576
1576
|
|
|
1577
|
+
// ../../core/sdk/iap/src/monitoring.ts
|
|
1578
|
+
var FORBIDDEN_IAP_FIELDS = [
|
|
1579
|
+
"memberid",
|
|
1580
|
+
"contactid",
|
|
1581
|
+
"sitememberid",
|
|
1582
|
+
"userid",
|
|
1583
|
+
"appuserid",
|
|
1584
|
+
"uuid",
|
|
1585
|
+
"visitorid",
|
|
1586
|
+
"signedtransaction",
|
|
1587
|
+
"jws",
|
|
1588
|
+
"signedinstance",
|
|
1589
|
+
"instance",
|
|
1590
|
+
"signedpayload",
|
|
1591
|
+
"cookie",
|
|
1592
|
+
"cookies",
|
|
1593
|
+
"authorization",
|
|
1594
|
+
"token",
|
|
1595
|
+
"accesstoken",
|
|
1596
|
+
"appaccounttoken",
|
|
1597
|
+
"refreshtoken",
|
|
1598
|
+
"session",
|
|
1599
|
+
"email",
|
|
1600
|
+
"emailaddress",
|
|
1601
|
+
"name",
|
|
1602
|
+
"firstname",
|
|
1603
|
+
"lastname",
|
|
1604
|
+
"fullname",
|
|
1605
|
+
"nickname",
|
|
1606
|
+
"phone"
|
|
1607
|
+
];
|
|
1608
|
+
var FORBIDDEN = new Set(FORBIDDEN_IAP_FIELDS);
|
|
1609
|
+
var JWS = /^[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}$/;
|
|
1610
|
+
var EMAIL = /[^\s@]+@[^\s@]+\.[^\s@]+/;
|
|
1611
|
+
var HTTP_FAILURE = /^HTTP (\d{3})(?: \[([A-Za-z0-9_]+)\])?/;
|
|
1612
|
+
var TRANSACTION = "IapPurchase";
|
|
1613
|
+
var isForbiddenKey = (key) => FORBIDDEN.has(key.toLowerCase().replace(/[_-]/g, ""));
|
|
1614
|
+
var isForbiddenValue = (value) => typeof value === "string" && (JWS.test(value) || EMAIL.test(value));
|
|
1615
|
+
function scrubIapData(data) {
|
|
1616
|
+
return scrubObject(data, 0);
|
|
1617
|
+
}
|
|
1618
|
+
var MAX_DEPTH = 3;
|
|
1619
|
+
function scrubObject(data, depth) {
|
|
1620
|
+
const kept = {};
|
|
1621
|
+
for (const [key, value] of Object.entries(data)) {
|
|
1622
|
+
if (isForbiddenKey(key)) continue;
|
|
1623
|
+
const scrubbed = scrubValue(value, depth);
|
|
1624
|
+
if (scrubbed !== void 0) kept[key] = scrubbed;
|
|
1625
|
+
}
|
|
1626
|
+
return kept;
|
|
1627
|
+
}
|
|
1628
|
+
function scrubValue(value, depth) {
|
|
1629
|
+
if (value === void 0 || isForbiddenValue(value)) return void 0;
|
|
1630
|
+
if (Array.isArray(value) || isPlainObject2(value)) {
|
|
1631
|
+
if (depth >= MAX_DEPTH) return void 0;
|
|
1632
|
+
return Array.isArray(value) ? value.map((item) => scrubValue(item, depth + 1)).filter((item) => item !== void 0) : scrubObject(value, depth + 1);
|
|
1633
|
+
}
|
|
1634
|
+
return value === null || ["string", "number", "boolean"].includes(typeof value) ? value : void 0;
|
|
1635
|
+
}
|
|
1636
|
+
function describeIapError(error) {
|
|
1637
|
+
try {
|
|
1638
|
+
if (error === void 0 || error === null) return {};
|
|
1639
|
+
const failure3 = typeof error === "object" ? error : {};
|
|
1640
|
+
const http = typeof failure3.message === "string" ? HTTP_FAILURE.exec(failure3.message) : null;
|
|
1641
|
+
const status = failure3.httpStatus ?? failure3.status ?? (http ? Number(http[1]) : void 0);
|
|
1642
|
+
const code = failure3.code ?? failure3.kind ?? http?.[2];
|
|
1643
|
+
return defined({
|
|
1644
|
+
// `httpStatus`, not `status`: an outcome's `status` is the purchase's (bought, failed…).
|
|
1645
|
+
httpStatus: typeof status === "number" ? status : void 0,
|
|
1646
|
+
code: typeof code === "string" ? code : void 0,
|
|
1647
|
+
requestId: typeof failure3.requestId === "string" ? failure3.requestId : void 0,
|
|
1648
|
+
// The error's type, never its message: the bridge copies part of the server's response into
|
|
1649
|
+
// the message, and no filter can recognise every id or token that text may echo.
|
|
1650
|
+
// Read by shape: a rejection can come from another realm.
|
|
1651
|
+
error: typeof failure3.name === "string" && typeof failure3.message === "string" ? failure3.name : void 0
|
|
1652
|
+
});
|
|
1653
|
+
} catch {
|
|
1654
|
+
return {};
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
function outcomeLevel(outcome) {
|
|
1658
|
+
if (outcome.status === "failed" || outcome.status === "error") return outcome.charged === true ? "error" : "warn";
|
|
1659
|
+
return "info";
|
|
1660
|
+
}
|
|
1661
|
+
function createIapMonitor(options) {
|
|
1662
|
+
const { sink } = options;
|
|
1663
|
+
const now = options.now ?? Date.now;
|
|
1664
|
+
const newId = options.newId ?? newFlowId;
|
|
1665
|
+
let gateLogged = false;
|
|
1666
|
+
function log(type, data = {}, level = "info") {
|
|
1667
|
+
safely(() => {
|
|
1668
|
+
const shared2 = safeContext(options.context);
|
|
1669
|
+
sink({ type, level, data: scrubIapData({ ...shared2, ...data, eventAt: now() }) });
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
function bug(fingerprint, error, data = {}) {
|
|
1673
|
+
log(`iap.bug.${fingerprint.replace("himi-iap-", "")}`, { ...data, ...describeIapError(error), fingerprint }, "error");
|
|
1674
|
+
}
|
|
1675
|
+
function gate(gate2) {
|
|
1676
|
+
if (gateLogged) return;
|
|
1677
|
+
gateLogged = true;
|
|
1678
|
+
log("iap.gate", gate2);
|
|
1679
|
+
}
|
|
1680
|
+
return { log, bug, gate, flow: (entry, ids = {}) => createIapFlow(entry, ids, { log, now, flowId: newId() }) };
|
|
1681
|
+
}
|
|
1682
|
+
function createIapFlow(entry, initial, host) {
|
|
1683
|
+
const { flowId } = host;
|
|
1684
|
+
const ids = {};
|
|
1685
|
+
const stepMs = {};
|
|
1686
|
+
const notes = {};
|
|
1687
|
+
const startedAt = host.now();
|
|
1688
|
+
let stepStartedAt = startedAt;
|
|
1689
|
+
let lastStep;
|
|
1690
|
+
const add = (next) => {
|
|
1691
|
+
Object.assign(ids, defined(next));
|
|
1692
|
+
};
|
|
1693
|
+
const data = (extra = {}) => ({ flowId, entry, ...ids, ...extra });
|
|
1694
|
+
const transaction = () => ({ transaction: TRANSACTION, id: flowId, flowId, entry });
|
|
1695
|
+
const closeStep = () => {
|
|
1696
|
+
const at = host.now();
|
|
1697
|
+
if (lastStep) stepMs[lastStep] = (stepMs[lastStep] ?? 0) + at - stepStartedAt;
|
|
1698
|
+
stepStartedAt = at;
|
|
1699
|
+
};
|
|
1700
|
+
add(initial);
|
|
1701
|
+
return {
|
|
1702
|
+
flowId,
|
|
1703
|
+
entry,
|
|
1704
|
+
add,
|
|
1705
|
+
get knownIds() {
|
|
1706
|
+
return { ...ids };
|
|
1707
|
+
},
|
|
1708
|
+
at(step) {
|
|
1709
|
+
closeStep();
|
|
1710
|
+
lastStep = step;
|
|
1711
|
+
},
|
|
1712
|
+
note(extra) {
|
|
1713
|
+
Object.assign(notes, defined(extra));
|
|
1714
|
+
},
|
|
1715
|
+
started(extra = {}) {
|
|
1716
|
+
host.log("iap.purchase.started", data(extra));
|
|
1717
|
+
host.log("iap.transaction.start", transaction());
|
|
1718
|
+
},
|
|
1719
|
+
failed(step, error, extra = {}, level = extra.charged === true ? "error" : "warn") {
|
|
1720
|
+
host.log(`iap.${step}.failed`, data({ ...describeIapError(error), ...extra }), level);
|
|
1721
|
+
},
|
|
1722
|
+
outcome(outcome, messageKey, extra = {}) {
|
|
1723
|
+
closeStep();
|
|
1724
|
+
host.log("iap.purchase.outcome", data({
|
|
1725
|
+
...notes,
|
|
1726
|
+
...outcome,
|
|
1727
|
+
messageKey,
|
|
1728
|
+
lastStep,
|
|
1729
|
+
stepMs: { ...stepMs },
|
|
1730
|
+
durationMs: host.now() - startedAt,
|
|
1731
|
+
...extra
|
|
1732
|
+
}), outcomeLevel(outcome));
|
|
1733
|
+
if (outcome.status === "bought") host.log("iap.transaction.finish", transaction());
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
function safeContext(context) {
|
|
1738
|
+
try {
|
|
1739
|
+
return context ? { ...context() } : {};
|
|
1740
|
+
} catch {
|
|
1741
|
+
return {};
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
function safely(run) {
|
|
1745
|
+
try {
|
|
1746
|
+
run();
|
|
1747
|
+
} catch {
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
function defined(data) {
|
|
1751
|
+
return Object.fromEntries(Object.entries(data).filter(([, value]) => value !== void 0));
|
|
1752
|
+
}
|
|
1753
|
+
function isPlainObject2(value) {
|
|
1754
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
1755
|
+
const prototype = Object.getPrototypeOf(value);
|
|
1756
|
+
return prototype === Object.prototype || prototype === null;
|
|
1757
|
+
}
|
|
1758
|
+
function newFlowId() {
|
|
1759
|
+
const random = globalThis.crypto?.randomUUID?.();
|
|
1760
|
+
return random ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1577
1763
|
// ../../core/sdk/iap/src/index.ts
|
|
1578
1764
|
async function storefrontCountryCode() {
|
|
1579
1765
|
try {
|
|
@@ -1584,6 +1770,12 @@ async function storefrontCountryCode() {
|
|
|
1584
1770
|
return null;
|
|
1585
1771
|
}
|
|
1586
1772
|
}
|
|
1773
|
+
var nativeIapEventSink = (event) => {
|
|
1774
|
+
try {
|
|
1775
|
+
dispatch("capability.iap.logEvent", { type: event.type, level: event.level, data: JSON.stringify(event.data) }).catch(() => void 0);
|
|
1776
|
+
} catch {
|
|
1777
|
+
}
|
|
1778
|
+
};
|
|
1587
1779
|
async function getProducts(productIds) {
|
|
1588
1780
|
if (!productIds || productIds.length === 0) return [];
|
|
1589
1781
|
const r = await dispatch("capability.iap.getProducts", {
|
|
@@ -1699,6 +1891,262 @@ function videosAppleSalesEnabled() {
|
|
|
1699
1891
|
return VIDEOS_APPLE_SALES_ENABLED;
|
|
1700
1892
|
}
|
|
1701
1893
|
|
|
1894
|
+
// ../../stdlib/flows/iap-checkout/src/iap-finish-policy.ts
|
|
1895
|
+
var COMPLETE_PAYMENT_REFUSALS = {
|
|
1896
|
+
// After recordPurchase (PurchaseMatcher.refusalOf / orphan): the purchase is recorded.
|
|
1897
|
+
NOT_PURCHASED: "refusedFinal",
|
|
1898
|
+
PURCHASE_REVOKED: "refusedFinal",
|
|
1899
|
+
ZERO_PRICE: "refusedFinal",
|
|
1900
|
+
NO_MATCHING_PAYMENT: "refusedFinal",
|
|
1901
|
+
PAYMENT_NOT_PENDING: "refusedFinal",
|
|
1902
|
+
// Before recordPurchase: nothing is recorded. Held pending owner confirmation.
|
|
1903
|
+
INVALID_PURCHASE: "hold",
|
|
1904
|
+
APP_NOT_CONFIGURED: "hold",
|
|
1905
|
+
OWNED_BY_ANOTHER_CUSTOMER: "ownershipConflict"
|
|
1906
|
+
};
|
|
1907
|
+
function isFinalRefusal(status) {
|
|
1908
|
+
return status === "canceling" || status === "canceled" || status === "refunding" || status === "refunded";
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// ../../stdlib/flows/iap-checkout/src/checkout-monitoring.ts
|
|
1912
|
+
var CHARGE_FAILURES = /* @__PURE__ */ new Set(["chargeFailed", "orderRefused", "orderClosed"]);
|
|
1913
|
+
var CHARGE_PATH = /\/orders\/[^/]+\/charges$/;
|
|
1914
|
+
var AFTER_SHEET_FAILURES = /* @__PURE__ */ new Set(["verificationFailed", "persistenceFailed", "invalidResponse"]);
|
|
1915
|
+
function createCheckoutMonitoring(deps) {
|
|
1916
|
+
let known = null;
|
|
1917
|
+
let current = null;
|
|
1918
|
+
let storeAnswered;
|
|
1919
|
+
const running = [];
|
|
1920
|
+
const trigger = () => running[running.length - 1] ?? "background";
|
|
1921
|
+
const finish = (entry) => {
|
|
1922
|
+
const at = running.lastIndexOf(entry);
|
|
1923
|
+
if (at >= 0) running.splice(at, 1);
|
|
1924
|
+
};
|
|
1925
|
+
const monitor = createIapMonitor({
|
|
1926
|
+
sink: deps.sink ?? nativeIapEventSink,
|
|
1927
|
+
context: () => ({ msid: known?.siteId, bundleId: known?.bundleId, isLoggedIn: deps.session.current().kind === "member" })
|
|
1928
|
+
});
|
|
1929
|
+
function binding(source) {
|
|
1930
|
+
return {
|
|
1931
|
+
current: async () => {
|
|
1932
|
+
const value = await source.current();
|
|
1933
|
+
known = value ?? known;
|
|
1934
|
+
return value;
|
|
1935
|
+
}
|
|
1936
|
+
};
|
|
1937
|
+
}
|
|
1938
|
+
function wixIap(client) {
|
|
1939
|
+
return {
|
|
1940
|
+
getPayment: (input) => client.getPayment(input),
|
|
1941
|
+
cancelPayment: (input) => client.cancelPayment(input),
|
|
1942
|
+
startPayment: async (input) => {
|
|
1943
|
+
const sender = current;
|
|
1944
|
+
if (sender) {
|
|
1945
|
+
sender.chargeError = void 0;
|
|
1946
|
+
sender.chargeRequested = false;
|
|
1947
|
+
}
|
|
1948
|
+
sender?.flow.add({ wixTransactionId: input.wixTransactionId });
|
|
1949
|
+
sender?.flow.at("start");
|
|
1950
|
+
const started = await client.startPayment(input);
|
|
1951
|
+
noteStarted(sender, started);
|
|
1952
|
+
return started;
|
|
1953
|
+
},
|
|
1954
|
+
startItemPayment: async (input) => {
|
|
1955
|
+
const sender = current;
|
|
1956
|
+
sender?.flow.add({ productIds: input.item.catalogItemId });
|
|
1957
|
+
sender?.flow.at("start");
|
|
1958
|
+
const started = await client.startItemPayment(input);
|
|
1959
|
+
noteStarted(sender, started);
|
|
1960
|
+
return started;
|
|
1961
|
+
},
|
|
1962
|
+
completePayment: async (transaction) => {
|
|
1963
|
+
const purchase2 = purchaseOf(transaction);
|
|
1964
|
+
purchase2?.flow.at("complete");
|
|
1965
|
+
const generation = deps.session.current().generation;
|
|
1966
|
+
const completed = await client.completePayment(transaction);
|
|
1967
|
+
if (purchase2 && purchase2 !== current || deps.session.current().generation !== generation) return completed;
|
|
1968
|
+
if (purchase2) noteCompleted(purchase2, transaction, completed);
|
|
1969
|
+
else noteRecovered(transaction, completed);
|
|
1970
|
+
return completed;
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
function noteStarted(sender, started) {
|
|
1975
|
+
if (!sender || sender !== current) return;
|
|
1976
|
+
const { flow } = sender;
|
|
1977
|
+
if (started.status === "started") {
|
|
1978
|
+
const { payment, storeProductId, appAccountToken } = started;
|
|
1979
|
+
flow.add({ wixTransactionId: payment.wixTransactionId, paymentId: payment.paymentId, storeProductId });
|
|
1980
|
+
sender.token = appAccountToken.toLowerCase();
|
|
1981
|
+
} else if (started.status === "failed") {
|
|
1982
|
+
flow.failed("start", started);
|
|
1983
|
+
} else {
|
|
1984
|
+
flow.failed("start", { code: started.status, httpStatus: started.httpStatus }, { kind: started.kind });
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
function noteCompleted(purchase2, transaction, completed) {
|
|
1988
|
+
const { flow } = purchase2;
|
|
1989
|
+
if (completed.status === "matched") {
|
|
1990
|
+
flow.add({ paymentId: completed.payment.paymentId });
|
|
1991
|
+
if (!isFinalRefusal(completed.payment.status)) {
|
|
1992
|
+
purchase2.completed = completed.payment.status === "pending" ? "pending" : "matched";
|
|
1993
|
+
return;
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
const refusal = refusalOf(completed);
|
|
1997
|
+
purchase2.completed = refusal === "final" ? "final" : "pending";
|
|
1998
|
+
flow.failed("complete", failureOf(completed), { charged: true, final: refusal === "final" }, LEVELS[refusal]);
|
|
1999
|
+
if (refusal === "final") monitor.bug("himi-iap-charged-not-completed", failureOf(completed), { ...flowIds(flow), transactionId: transaction.transactionId });
|
|
2000
|
+
}
|
|
2001
|
+
function noteRecovered(transaction, completed) {
|
|
2002
|
+
const payment = completed.status === "matched" ? completed.payment : void 0;
|
|
2003
|
+
const refusal = payment?.status === "pending" ? "retried" : payment && !isFinalRefusal(payment.status) ? null : refusalOf(completed);
|
|
2004
|
+
const ids = { transactionId: transaction.transactionId, storeProductId: transaction.productId, paymentId: payment?.paymentId, wixTransactionId: payment?.wixTransactionId };
|
|
2005
|
+
const outcome = refusal === null ? "completed" : refusal === "final" ? "refused" : refusal === "otherMember" ? "otherMember" : "held";
|
|
2006
|
+
const by = trigger();
|
|
2007
|
+
monitor.log("iap.recovery.outcome", { ...ids, ...failureOf(completed), trigger: by, outcome, charged: true }, refusal === null ? "info" : LEVELS[refusal]);
|
|
2008
|
+
if (refusal === "final") monitor.bug("himi-iap-charged-not-completed", failureOf(completed), { ...ids, trigger: by });
|
|
2009
|
+
}
|
|
2010
|
+
function bridge(inner) {
|
|
2011
|
+
return {
|
|
2012
|
+
observes: inner,
|
|
2013
|
+
call: async (method, path, ...rest) => {
|
|
2014
|
+
const charging = method === "POST" && CHARGE_PATH.test(path) ? current : null;
|
|
2015
|
+
if (charging) charging.chargeRequested = true;
|
|
2016
|
+
charging?.flow.at("charge");
|
|
2017
|
+
try {
|
|
2018
|
+
return await inner.call(method, path, ...rest);
|
|
2019
|
+
} catch (error) {
|
|
2020
|
+
if (charging) charging.chargeError = error;
|
|
2021
|
+
throw error;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
2026
|
+
function orderFailed(failure3) {
|
|
2027
|
+
if (!current || !failure3 || !current.chargeRequested) return;
|
|
2028
|
+
const { chargeError } = current;
|
|
2029
|
+
if (!CHARGE_FAILURES.has(failure3) && !(chargeError !== void 0 && failure3 === "unavailable")) return;
|
|
2030
|
+
current.chargeError = void 0;
|
|
2031
|
+
current.flow.failed("charge", chargeError ?? { code: failure3 }, { failure: failure3 });
|
|
2032
|
+
}
|
|
2033
|
+
function store(inner) {
|
|
2034
|
+
return {
|
|
2035
|
+
getUnfinishedTransactions: async () => {
|
|
2036
|
+
const listed = await inner.getUnfinishedTransactions();
|
|
2037
|
+
if (listed.status === "ok") storeAnswered ?? (storeAnswered = true);
|
|
2038
|
+
else if (listed.code === "unsupported" || listed.code === "unavailable") storeAnswered ?? (storeAnswered = false);
|
|
2039
|
+
return listed;
|
|
2040
|
+
},
|
|
2041
|
+
purchaseForVerification: async (input) => {
|
|
2042
|
+
const sender = current;
|
|
2043
|
+
const generation = deps.session.current().generation;
|
|
2044
|
+
sender?.flow.at("storekit");
|
|
2045
|
+
const result = await inner.purchaseForVerification(input);
|
|
2046
|
+
if (!sender || sender !== current || deps.session.current().generation !== generation) return result;
|
|
2047
|
+
if (result.status === "purchased" && result.transaction.appAccountToken?.toLowerCase() === sender.token) {
|
|
2048
|
+
sender.charged = true;
|
|
2049
|
+
sender.flow.add({ transactionId: result.transaction.transactionId, storeProductId: result.transaction.productId });
|
|
2050
|
+
}
|
|
2051
|
+
if (result.status === "failed") {
|
|
2052
|
+
const maybeCharged = AFTER_SHEET_FAILURES.has(result.code);
|
|
2053
|
+
if (maybeCharged) sender.maybeCharged = true;
|
|
2054
|
+
sender.flow.failed("storekit", { code: result.code }, { maybeCharged, storeProductId: input.productId });
|
|
2055
|
+
}
|
|
2056
|
+
return result;
|
|
2057
|
+
},
|
|
2058
|
+
finishTransaction: async (input) => {
|
|
2059
|
+
const purchase2 = current && current.flow.knownIds.transactionId === input.transactionId ? current : null;
|
|
2060
|
+
purchase2?.flow.at("finish");
|
|
2061
|
+
const result = await inner.finishTransaction(input);
|
|
2062
|
+
if (result.status === "failed") {
|
|
2063
|
+
monitor.log("iap.finish.failed", { ...purchase2 ? flowIds(purchase2.flow) : { trigger: trigger() }, transactionId: input.transactionId, code: result.code }, "error");
|
|
2064
|
+
}
|
|
2065
|
+
return result;
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
async function purchase(run) {
|
|
2070
|
+
const owned = { purchase: null };
|
|
2071
|
+
const begin = () => {
|
|
2072
|
+
if (current) return;
|
|
2073
|
+
owned.purchase = current = { flow: monitor.flow("page"), charged: false };
|
|
2074
|
+
owned.purchase.flow.started();
|
|
2075
|
+
};
|
|
2076
|
+
running.push("beforePurchase");
|
|
2077
|
+
try {
|
|
2078
|
+
const state = await run(begin);
|
|
2079
|
+
owned.purchase?.flow.outcome(outcomeOf(owned.purchase, state), state.failure ?? state.phase);
|
|
2080
|
+
return state;
|
|
2081
|
+
} catch (error) {
|
|
2082
|
+
const failed = owned.purchase;
|
|
2083
|
+
monitor.bug("himi-iap-unexpected", error, failed ? flowIds(failed.flow) : {});
|
|
2084
|
+
failed?.flow.outcome({ status: "error", charged: failed.charged }, "unexpected");
|
|
2085
|
+
throw error;
|
|
2086
|
+
} finally {
|
|
2087
|
+
finish("beforePurchase");
|
|
2088
|
+
if (owned.purchase && current === owned.purchase) current = null;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
async function recovery(next, run) {
|
|
2092
|
+
running.push(next);
|
|
2093
|
+
try {
|
|
2094
|
+
return await run();
|
|
2095
|
+
} catch (error) {
|
|
2096
|
+
monitor.bug("himi-iap-recovery-crash", error, { trigger: next });
|
|
2097
|
+
throw error;
|
|
2098
|
+
} finally {
|
|
2099
|
+
finish(next);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
function purchaseOf(transaction) {
|
|
2103
|
+
const token = transaction.appAccountToken?.toLowerCase();
|
|
2104
|
+
return current && token && current.token === token ? current : null;
|
|
2105
|
+
}
|
|
2106
|
+
return {
|
|
2107
|
+
wixIap,
|
|
2108
|
+
store,
|
|
2109
|
+
bridge,
|
|
2110
|
+
binding,
|
|
2111
|
+
purchase,
|
|
2112
|
+
recovery,
|
|
2113
|
+
notRun: (reason) => monitor.log("iap.checkout.notRun", { reason }, "warn"),
|
|
2114
|
+
loginFailed: (from) => monitor.log("iap.login.failed", { from }, "warn"),
|
|
2115
|
+
orderFailed,
|
|
2116
|
+
paidUnitStuck: (ref) => monitor.bug("himi-iap-paid-unit-stuck", null, {
|
|
2117
|
+
paymentId: ref.paymentId,
|
|
2118
|
+
wixTransactionId: ref.wixTransactionId,
|
|
2119
|
+
storeProductId: ref.storeProductId,
|
|
2120
|
+
transactionId: ref.appleTransactionId
|
|
2121
|
+
}),
|
|
2122
|
+
// StoreKit's own answer when it has given one: a sign-in prompt can hide an unsupported store.
|
|
2123
|
+
gate: (storeKit) => monitor.gate({ enabled: true, storeKit: storeAnswered ?? storeKit, experiment: false })
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
var LEVELS = { final: "error", retried: "warn", otherMember: "info" };
|
|
2127
|
+
function refusalOf(completed) {
|
|
2128
|
+
if (completed.status === "matched") return "final";
|
|
2129
|
+
if (completed.kind !== "application") return "retried";
|
|
2130
|
+
const refusal = COMPLETE_PAYMENT_REFUSALS[completed.code];
|
|
2131
|
+
return refusal === "refusedFinal" ? "final" : refusal === "ownershipConflict" ? "otherMember" : "retried";
|
|
2132
|
+
}
|
|
2133
|
+
function failureOf(completed) {
|
|
2134
|
+
if (completed.status === "matched") return { code: `payment_${completed.payment.status}` };
|
|
2135
|
+
return { code: completed.kind === "application" ? completed.code : completed.kind, httpStatus: completed.httpStatus };
|
|
2136
|
+
}
|
|
2137
|
+
function outcomeOf(purchase, state) {
|
|
2138
|
+
const { charged, completed } = purchase;
|
|
2139
|
+
if (completed === "final") return { status: "failed", charged };
|
|
2140
|
+
if (completed === "matched") return { status: "bought", charged };
|
|
2141
|
+
if (charged) return { status: "pending", charged };
|
|
2142
|
+
if (state.phase === "cancelled") return { status: "cancelled", charged };
|
|
2143
|
+
if (state.phase === "awaitingApproval") return { status: "pending", charged };
|
|
2144
|
+
return purchase.maybeCharged ? { status: "failed", charged, maybeCharged: true } : { status: "failed", charged };
|
|
2145
|
+
}
|
|
2146
|
+
function flowIds(flow) {
|
|
2147
|
+
return { flowId: flow.flowId, entry: flow.entry, ...flow.knownIds };
|
|
2148
|
+
}
|
|
2149
|
+
|
|
1702
2150
|
// ../../stdlib/flows/iap-checkout/src/cashier-charges.ts
|
|
1703
2151
|
async function ensureAppleIapCharge(bridge, route, orderId) {
|
|
1704
2152
|
const invalid = invalidRequest(route, orderId);
|
|
@@ -1716,7 +2164,7 @@ function invalidRequest(route, orderId) {
|
|
|
1716
2164
|
}
|
|
1717
2165
|
async function listOrderCharges(bridge, route, orderId) {
|
|
1718
2166
|
const answer = await bridge.call("GET", chargesPath(route, orderId));
|
|
1719
|
-
if (answer.status !== "ok") return
|
|
2167
|
+
if (answer.status !== "ok") return failureOf2(answer);
|
|
1720
2168
|
const charges = decodeCharges(answer.body);
|
|
1721
2169
|
return charges ? { status: "ok", charges } : { status: "invalidResponse" };
|
|
1722
2170
|
}
|
|
@@ -1761,7 +2209,7 @@ function decodeCharge(raw) {
|
|
|
1761
2209
|
const method = isNonEmpty2(raw.paymentMethodId) ? raw.paymentMethodId : isNonEmpty2(raw.paymentMethod) ? raw.paymentMethod : "";
|
|
1762
2210
|
return { chargeId: raw.chargeId, transactionId: raw.transactionId, status: isNonEmpty2(state.status) ? state.status : "UNDEFINED", paymentMethod: method };
|
|
1763
2211
|
}
|
|
1764
|
-
function
|
|
2212
|
+
function failureOf2(answer) {
|
|
1765
2213
|
return answer.status === "http" ? { status: "refused" } : { status: answer.status };
|
|
1766
2214
|
}
|
|
1767
2215
|
function chargesPath(route, orderId) {
|
|
@@ -1782,23 +2230,6 @@ var AWAITING_PAYMENT = /* @__PURE__ */ new Set(["INITIALIZATION", "INITIALIZED",
|
|
|
1782
2230
|
var RETRYABLE_AFTER = /* @__PURE__ */ new Set(["DECLINED", "FAILED"]);
|
|
1783
2231
|
var CLOSED = /* @__PURE__ */ new Set(["BUYER_CANCELED", "TIMEOUT", "VOIDED", "REFUND", "CHARGE_BACK", "OFFLINE"]);
|
|
1784
2232
|
|
|
1785
|
-
// ../../stdlib/flows/iap-checkout/src/iap-finish-policy.ts
|
|
1786
|
-
var COMPLETE_PAYMENT_REFUSALS = {
|
|
1787
|
-
// After recordPurchase (PurchaseMatcher.refusalOf / orphan): the purchase is recorded.
|
|
1788
|
-
NOT_PURCHASED: "refusedFinal",
|
|
1789
|
-
PURCHASE_REVOKED: "refusedFinal",
|
|
1790
|
-
ZERO_PRICE: "refusedFinal",
|
|
1791
|
-
NO_MATCHING_PAYMENT: "refusedFinal",
|
|
1792
|
-
PAYMENT_NOT_PENDING: "refusedFinal",
|
|
1793
|
-
// Before recordPurchase: nothing is recorded. Held pending owner confirmation.
|
|
1794
|
-
INVALID_PURCHASE: "hold",
|
|
1795
|
-
APP_NOT_CONFIGURED: "hold",
|
|
1796
|
-
OWNED_BY_ANOTHER_CUSTOMER: "ownershipConflict"
|
|
1797
|
-
};
|
|
1798
|
-
function isFinalRefusal(status) {
|
|
1799
|
-
return status === "canceling" || status === "canceled" || status === "refunding" || status === "refunded";
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
2233
|
// ../../stdlib/flows/iap-checkout/src/order-refs.ts
|
|
1803
2234
|
var NEEDS_SUPPORT_HOLD_MS = 6048e5;
|
|
1804
2235
|
var ITEM_START_HOLD_MS = 36e5;
|
|
@@ -1871,12 +2302,12 @@ function createWorkerOrderRefStore(storage) {
|
|
|
1871
2302
|
const store = kv();
|
|
1872
2303
|
if (!store) return false;
|
|
1873
2304
|
for (let attempt3 = 0; attempt3 < WRITE_ATTEMPTS; attempt3++) {
|
|
1874
|
-
const raw =
|
|
2305
|
+
const raw = safely2(() => store.getItem(location));
|
|
1875
2306
|
const current = parseRefs(raw);
|
|
1876
2307
|
const next = current && change(current);
|
|
1877
2308
|
if (!next) return false;
|
|
1878
2309
|
if (next.length > 0 && !updateIndex(store, key, true)) return false;
|
|
1879
|
-
if (
|
|
2310
|
+
if (safely2(() => store.getItem(location)) !== raw) continue;
|
|
1880
2311
|
if (!writeVerified(store, location, serialize({ v: VERSION, refs: next }))) return false;
|
|
1881
2312
|
if (next.length === 0) updateIndex(store, key, false);
|
|
1882
2313
|
return true;
|
|
@@ -1906,7 +2337,7 @@ function updateIndex(store, key, holdsRefs) {
|
|
|
1906
2337
|
return next.length === members.length && next.every((m, i) => m === members[i]) || writeVerified(store, location, serialize({ v: VERSION, members: next }));
|
|
1907
2338
|
}
|
|
1908
2339
|
function readRefs(store, location) {
|
|
1909
|
-
return store ? parseRefs(
|
|
2340
|
+
return store ? parseRefs(safely2(() => store.getItem(location))) : null;
|
|
1910
2341
|
}
|
|
1911
2342
|
function parseRefs(raw) {
|
|
1912
2343
|
const parsed = parseVersioned(raw);
|
|
@@ -1921,17 +2352,17 @@ function readIndex(store, location) {
|
|
|
1921
2352
|
return parsed.members;
|
|
1922
2353
|
}
|
|
1923
2354
|
function readVersioned(store, location) {
|
|
1924
|
-
return store ? parseVersioned(
|
|
2355
|
+
return store ? parseVersioned(safely2(() => store.getItem(location))) : null;
|
|
1925
2356
|
}
|
|
1926
2357
|
function parseVersioned(raw) {
|
|
1927
2358
|
if (raw === void 0) return null;
|
|
1928
2359
|
if (raw === null || raw === "") return "empty";
|
|
1929
|
-
const parsed =
|
|
2360
|
+
const parsed = safely2(() => JSON.parse(raw));
|
|
1930
2361
|
return isObject6(parsed) && parsed.v === VERSION ? parsed : null;
|
|
1931
2362
|
}
|
|
1932
2363
|
function writeVerified(store, location, value) {
|
|
1933
2364
|
if (!store) return false;
|
|
1934
|
-
return
|
|
2365
|
+
return safely2(() => {
|
|
1935
2366
|
store.setItem(location, value);
|
|
1936
2367
|
return store.getItem(location) === value;
|
|
1937
2368
|
}) === true;
|
|
@@ -1976,7 +2407,7 @@ function hostStorage() {
|
|
|
1976
2407
|
const storage = globalThis.himalaya?.storage;
|
|
1977
2408
|
return typeof storage?.getItem === "function" && typeof storage.setItem === "function" ? storage : void 0;
|
|
1978
2409
|
}
|
|
1979
|
-
function
|
|
2410
|
+
function safely2(read2) {
|
|
1980
2411
|
try {
|
|
1981
2412
|
return read2();
|
|
1982
2413
|
} catch {
|
|
@@ -2025,7 +2456,7 @@ async function attempt2(bridge, method, path, body, expectation) {
|
|
|
2025
2456
|
const answer = expectation ? await bridge.call(method, path, body, void 0, expectation) : await bridge.call(method, path, body);
|
|
2026
2457
|
return { status: "ok", body: answer };
|
|
2027
2458
|
} catch (error) {
|
|
2028
|
-
return
|
|
2459
|
+
return refusalOf2(error);
|
|
2029
2460
|
}
|
|
2030
2461
|
}
|
|
2031
2462
|
function boundExpectation(session, provider, bridge) {
|
|
@@ -2037,9 +2468,13 @@ function boundExpectation(session, provider, bridge) {
|
|
|
2037
2468
|
}
|
|
2038
2469
|
function isLiveHost(bridge) {
|
|
2039
2470
|
const api = globalThis.himalaya?.wixApi;
|
|
2040
|
-
|
|
2471
|
+
if (api == null) return false;
|
|
2472
|
+
for (let at = bridge; at; at = at.observes) {
|
|
2473
|
+
if (at === api || at.call === api.call) return true;
|
|
2474
|
+
}
|
|
2475
|
+
return false;
|
|
2041
2476
|
}
|
|
2042
|
-
function
|
|
2477
|
+
function refusalOf2(error) {
|
|
2043
2478
|
const message = error?.message;
|
|
2044
2479
|
const text2 = typeof message === "string" ? message : "";
|
|
2045
2480
|
if (BRIDGE_REFUSAL2.test(text2)) return { status: "notEnabled" };
|
|
@@ -2623,23 +3058,28 @@ function enabledCheckout(deps) {
|
|
|
2623
3058
|
let tracking = Promise.resolve();
|
|
2624
3059
|
let partitionRead = null;
|
|
2625
3060
|
const awaitingApproval = /* @__PURE__ */ new Map();
|
|
3061
|
+
const monitoring = createCheckoutMonitoring({ sink: deps.monitorSink, session: deps.session });
|
|
3062
|
+
const watchedBinding = monitoring.binding(deps.binding);
|
|
2626
3063
|
const backend = createWixOrderBackend({
|
|
2627
|
-
wixIap: deps.wixIap,
|
|
3064
|
+
wixIap: monitoring.wixIap(deps.wixIap),
|
|
2628
3065
|
identity: deps.identity,
|
|
2629
|
-
binding:
|
|
3066
|
+
binding: watchedBinding,
|
|
2630
3067
|
session: deps.session,
|
|
2631
3068
|
clock: deps.clock,
|
|
2632
3069
|
cashier: deps.cashier,
|
|
2633
3070
|
adapters: deps.adapters,
|
|
2634
3071
|
refs,
|
|
2635
|
-
bridge,
|
|
3072
|
+
bridge: monitoring.bridge(bridge),
|
|
2636
3073
|
itemFor: (key) => sales.get(key),
|
|
2637
3074
|
productBusy,
|
|
2638
|
-
report:
|
|
3075
|
+
report: (event) => {
|
|
3076
|
+
monitoring.orderFailed(event.failure);
|
|
3077
|
+
onEvent(event);
|
|
3078
|
+
},
|
|
2639
3079
|
storeCountry: deps.storeCountry ?? storefrontCountryCode
|
|
2640
3080
|
});
|
|
2641
3081
|
const coordinator = createPurchaseCoordinator({
|
|
2642
|
-
store: deps.store ?? appleManagedStore,
|
|
3082
|
+
store: monitoring.store(deps.store ?? appleManagedStore),
|
|
2643
3083
|
backend,
|
|
2644
3084
|
session: deps.session,
|
|
2645
3085
|
clock: deps.clock,
|
|
@@ -2647,11 +3087,14 @@ function enabledCheckout(deps) {
|
|
|
2647
3087
|
onState: publish,
|
|
2648
3088
|
onAwaitingApproval: reserveAskToBuy
|
|
2649
3089
|
});
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
3090
|
+
function start() {
|
|
3091
|
+
return monitoring.recovery("launch", async () => {
|
|
3092
|
+
resetIfSessionChanged();
|
|
3093
|
+
await coordinator.start();
|
|
3094
|
+
await trackPayments({ dueOnly: false });
|
|
3095
|
+
monitoring.gate(coordinator.getState().phase !== "unavailable");
|
|
3096
|
+
return state();
|
|
3097
|
+
});
|
|
2655
3098
|
}
|
|
2656
3099
|
async function checkAccess(items) {
|
|
2657
3100
|
resetIfSessionChanged();
|
|
@@ -2675,36 +3118,52 @@ function enabledCheckout(deps) {
|
|
|
2675
3118
|
}
|
|
2676
3119
|
return publishAndReturn();
|
|
2677
3120
|
}
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
3121
|
+
function buy(item) {
|
|
3122
|
+
return monitoring.purchase(async (begin) => {
|
|
3123
|
+
resetIfSessionChanged();
|
|
3124
|
+
const key = itemKey(item);
|
|
3125
|
+
const appleProduct = settledAppleProduct(item);
|
|
3126
|
+
current = { item: key, failure: appleProduct ? null : "notAppleRoute", buying: false };
|
|
3127
|
+
if (!appleProduct) {
|
|
3128
|
+
monitoring.notRun("notAppleRoute");
|
|
3129
|
+
return publishAndReturn();
|
|
3130
|
+
}
|
|
3131
|
+
sales.set(key, { item, appleProduct });
|
|
3132
|
+
if (deps.session.current().kind === "member") begin();
|
|
3133
|
+
else {
|
|
3134
|
+
monitoring.loginFailed("checkout");
|
|
3135
|
+
monitoring.notRun("notLoggedIn");
|
|
3136
|
+
}
|
|
3137
|
+
current.buying = true;
|
|
3138
|
+
publish();
|
|
3139
|
+
await coordinator.purchase(key);
|
|
3140
|
+
if (current.item === key) current.buying = false;
|
|
3141
|
+
return publishAndReturn();
|
|
3142
|
+
});
|
|
2690
3143
|
}
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
3144
|
+
function reconcile2() {
|
|
3145
|
+
return monitoring.recovery("reconcile", async () => {
|
|
3146
|
+
resetIfSessionChanged();
|
|
3147
|
+
await coordinator.reconcile();
|
|
3148
|
+
await trackPayments({ dueOnly: false });
|
|
3149
|
+
return state();
|
|
3150
|
+
});
|
|
2696
3151
|
}
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
3152
|
+
function retry2() {
|
|
3153
|
+
return monitoring.recovery("retry", async () => {
|
|
3154
|
+
resetIfSessionChanged();
|
|
3155
|
+
await coordinator.retry();
|
|
3156
|
+
await trackPayments({ dueOnly: false });
|
|
3157
|
+
return state();
|
|
3158
|
+
});
|
|
2702
3159
|
}
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
3160
|
+
function tick() {
|
|
3161
|
+
return monitoring.recovery("tick", async () => {
|
|
3162
|
+
resetIfSessionChanged();
|
|
3163
|
+
await coordinator.tick();
|
|
3164
|
+
await trackPayments({ dueOnly: true });
|
|
3165
|
+
return state();
|
|
3166
|
+
});
|
|
2708
3167
|
}
|
|
2709
3168
|
function state() {
|
|
2710
3169
|
if (disposed || deps.session.current().generation !== generation) return blankState(true);
|
|
@@ -2822,7 +3281,7 @@ function enabledCheckout(deps) {
|
|
|
2822
3281
|
}
|
|
2823
3282
|
}
|
|
2824
3283
|
async function trackedPartition(session) {
|
|
2825
|
-
const binding = await bindingOf(
|
|
3284
|
+
const binding = await bindingOf(watchedBinding);
|
|
2826
3285
|
if (!binding || !isCurrent(session)) return binding === null ? "none" : null;
|
|
2827
3286
|
const stored = refs.hasRefs(binding);
|
|
2828
3287
|
if (stored !== true) return stored === false ? "none" : null;
|
|
@@ -2893,7 +3352,10 @@ function enabledCheckout(deps) {
|
|
|
2893
3352
|
const payment = payments.get(ref.key) ?? newTracked(ref.key);
|
|
2894
3353
|
const attempts = payment.attempts + 1;
|
|
2895
3354
|
const exhausted = attempts >= MAX_AUTOMATIC_ATTEMPTS;
|
|
2896
|
-
if (exhausted && approvedWithoutAccess)
|
|
3355
|
+
if (exhausted && approvedWithoutAccess) {
|
|
3356
|
+
monitoring.paidUnitStuck(ref);
|
|
3357
|
+
return markNeedsSupport(partition, ref);
|
|
3358
|
+
}
|
|
2897
3359
|
const nextAttemptAt = exhausted ? null : deps.clock.now() + backoffDelay(attempts, deps.jitter);
|
|
2898
3360
|
payments.set(ref.key, { ...payment, access: "processing", attempts, nextAttemptAt });
|
|
2899
3361
|
}
|