@wix/himalaya-cli 0.1496.0 → 0.1497.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/attendance-classifier.d.ts +37 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-pricing-contract.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/index.d.ts +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-contract.d.ts +11 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +27 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-contract.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/attendance.d.ts +10 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/index.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/events/src/index.d.ts +33 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +346 -26
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +132 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +366 -48
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-events.mjs +5 -0
- package/dist/cli.mjs +816 -666
- package/guides/iap-products.md +7 -1
- package/guides/sdk-reference.json +376 -27
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +394 -0
- package/templates/beauty-salon/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/beauty-salon/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/beauty-salon/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +52 -7
- package/templates/branded-lite/dev/index.ts +1073 -284
- package/templates/branded-lite/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/branded-lite/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/branded-lite/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +52 -7
- package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +112 -21
- package/templates/community-club/dev/index.ts +397 -2
- package/templates/community-club/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/community-club/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/community-club/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/community-club/tier5-src/himi-events-detail/index.ts +112 -21
- package/templates/events-meetups/dev/index.ts +397 -2
- package/templates/events-meetups/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/events-meetups/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/events-meetups/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +112 -21
- package/templates/gym-fitness/dev/index.ts +828 -39
- package/templates/gym-fitness/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/gym-fitness/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/gym-fitness/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +52 -7
- package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +112 -21
- package/templates/nonprofit-cause/dev/index.ts +397 -2
- package/templates/nonprofit-cause/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/nonprofit-cause/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/nonprofit-cause/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +112 -21
- package/templates/podcast-creator/dev/index.ts +397 -2
- package/templates/podcast-creator/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/podcast-creator/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/podcast-creator/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +112 -21
- package/templates/portfolio-creative/dev/index.ts +397 -2
- package/templates/portfolio-creative/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/portfolio-creative/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/portfolio-creative/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +112 -21
- package/templates/restaurant/dev/index.ts +397 -2
- package/templates/restaurant/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/restaurant/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/restaurant/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/restaurant/tier5-src/himi-events-detail/index.ts +112 -21
- package/templates/yoga-studio/dev/index.ts +828 -39
- package/templates/yoga-studio/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/yoga-studio/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
- package/templates/yoga-studio/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +52 -7
- package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +112 -21
|
@@ -641,7 +641,8 @@ function applePrice(mapping, products) {
|
|
|
641
641
|
const matches = products.filter((value) => isObject2(value) && value.id === mapping.productId);
|
|
642
642
|
const product = matches[0];
|
|
643
643
|
if (matches.length !== 1 || !nonempty(product?.displayPrice)) return unavailable(mapping.reference, "priceUnavailable");
|
|
644
|
-
|
|
644
|
+
const attendance = mapping.reference.kind === "bookingsService" || mapping.reference.kind === "eventsTicket";
|
|
645
|
+
if (product?.type !== (attendance ? "consumable" : "nonConsumable")) return unavailable(mapping.reference, "unsupportedProductType");
|
|
645
646
|
return {
|
|
646
647
|
reference: mapping.reference,
|
|
647
648
|
status: "ready",
|
|
@@ -659,10 +660,13 @@ var nonempty = (value) => typeof value === "string" && value.trim().length > 0;
|
|
|
659
660
|
var sameReference = (value, reference) => isObject2(value) && value.kind === reference.kind && value.id === reference.id;
|
|
660
661
|
|
|
661
662
|
// ../../core/sdk/iap/src/catalog-pricing-contract.ts
|
|
662
|
-
var IAP_CATALOG_KINDS = ["onlineProgram", "storesProduct", "pricingPlan"];
|
|
663
|
+
var IAP_CATALOG_KINDS = ["onlineProgram", "storesProduct", "pricingPlan", "bookingsService", "eventsTicket"];
|
|
663
664
|
|
|
664
665
|
// ../../core/sdk/iap/src/wix-payments-contract.ts
|
|
665
666
|
var HIMALAYA_SERVE_IAP_ROUTE = { prefix: "/himalaya-serve/v1/iap" };
|
|
667
|
+
var BOOKINGS_APPLE_SALES_ENABLED = false;
|
|
668
|
+
var EVENTS_APPLE_SALES_ENABLED = false;
|
|
669
|
+
var ATTENDANCE_SALE_RULE = { appProductId: (id) => id, productType: "CONSUMABLE" };
|
|
666
670
|
var STORES_ITEM_PAYMENT_ENABLED = false;
|
|
667
671
|
var STORES_APPLE_SALES_ENABLED = true;
|
|
668
672
|
var STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
|
|
@@ -673,10 +677,17 @@ function appleSaleRules(options = {}) {
|
|
|
673
677
|
return {
|
|
674
678
|
onlineProgram: ONLINE_PROGRAM_SALE_RULE,
|
|
675
679
|
...(options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED) || (options.storesItemPaymentEnabled ?? STORES_ITEM_PAYMENT_ENABLED) ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
|
|
676
|
-
...options.pricingPlanAppleSalesEnabled ?? PRICING_PLAN_APPLE_SALES_ENABLED ? { pricingPlan: PRICING_PLAN_SALE_RULE } : {}
|
|
680
|
+
...options.pricingPlanAppleSalesEnabled ?? PRICING_PLAN_APPLE_SALES_ENABLED ? { pricingPlan: PRICING_PLAN_SALE_RULE } : {},
|
|
681
|
+
...options.bookingsAppleSalesEnabled ?? BOOKINGS_APPLE_SALES_ENABLED ? { bookingsService: ATTENDANCE_SALE_RULE } : {},
|
|
682
|
+
...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {}
|
|
677
683
|
};
|
|
678
684
|
}
|
|
679
685
|
var APPLE_SALE_RULES = appleSaleRules();
|
|
686
|
+
var APPLE_PROVISIONING_RULES = {
|
|
687
|
+
...APPLE_SALE_RULES,
|
|
688
|
+
bookingsService: ATTENDANCE_SALE_RULE,
|
|
689
|
+
eventsTicket: ATTENDANCE_SALE_RULE
|
|
690
|
+
};
|
|
680
691
|
|
|
681
692
|
// ../../core/sdk/iap/src/mapping-source.ts
|
|
682
693
|
function iapMappingSource() {
|
|
@@ -1347,6 +1358,116 @@ var COMPLETE_PAYMENT_CODES = [
|
|
|
1347
1358
|
];
|
|
1348
1359
|
var GET_PAYMENT_CODES = ["NOT_FOUND"];
|
|
1349
1360
|
|
|
1361
|
+
// ../../core/sdk/iap/src/attendance-classifier.ts
|
|
1362
|
+
function classifyForApple(item, currency) {
|
|
1363
|
+
if (item.hidden !== false || item.attendance === "hybrid") return "decide";
|
|
1364
|
+
if (item.kind === "bookingsService") return bookingRoute(item, currency);
|
|
1365
|
+
return ticketRoute(item, currency);
|
|
1366
|
+
}
|
|
1367
|
+
function attendanceCheckoutRoute(item, currency, platform) {
|
|
1368
|
+
if (["android", "web"].includes(platform)) return "regular";
|
|
1369
|
+
const route = classifyForApple(item, currency);
|
|
1370
|
+
if (route === "wixPayments") return "regular";
|
|
1371
|
+
const enabled = item.kind === "bookingsService" ? BOOKINGS_APPLE_SALES_ENABLED : EVENTS_APPLE_SALES_ENABLED;
|
|
1372
|
+
return platform === "ios" && route === "appleIap" && enabled ? "appleIap" : "blocked";
|
|
1373
|
+
}
|
|
1374
|
+
function bookingRoute(item, currency) {
|
|
1375
|
+
if (item.onlineBooking !== true) return "decide";
|
|
1376
|
+
if (item.conferencing === false && item.locations?.length && item.locations.every((type) => type === "BUSINESS" || type === "CUSTOMER" || type === "CUSTOM")) {
|
|
1377
|
+
return item.attendance === "online" ? "decide" : "wixPayments";
|
|
1378
|
+
}
|
|
1379
|
+
if (item.conferencing !== true || item.attendance === "physical") return "decide";
|
|
1380
|
+
if (item.attendance !== "online" && (!item.locations || item.locations.length > 0)) return "decide";
|
|
1381
|
+
if (item.type === "APPOINTMENT") {
|
|
1382
|
+
return item.capacity === 1 && item.maxParticipantsPerBooking === 1 ? "wixPayments" : "decide";
|
|
1383
|
+
}
|
|
1384
|
+
if (item.type !== "CLASS" && item.type !== "COURSE" || !item.capacity || item.capacity <= 1) return "decide";
|
|
1385
|
+
if (item.priceType === "NO_FEE" || zeroPrice(item.amount)) return "wixPayments";
|
|
1386
|
+
if (item.onlinePayment !== true || item.deposit !== false || item.priceType !== "FIXED") return "decide";
|
|
1387
|
+
return fixedPriceRoute(item, currency);
|
|
1388
|
+
}
|
|
1389
|
+
function ticketRoute(item, currency) {
|
|
1390
|
+
if (item.location === "VENUE") return item.attendance === "online" ? "decide" : "wixPayments";
|
|
1391
|
+
if (item.location !== "ONLINE" || item.attendance === "physical" || item.registration !== "TICKETING") return "decide";
|
|
1392
|
+
if (item.eventStatus !== "UPCOMING" && item.eventStatus !== "STARTED") return "decide";
|
|
1393
|
+
if (item.saleStatus !== "SALE_STARTED") return "decide";
|
|
1394
|
+
if (zeroPrice(item.amount)) return "wixPayments";
|
|
1395
|
+
return item.priceType === "STANDARD" ? fixedPriceRoute(item, currency) : "decide";
|
|
1396
|
+
}
|
|
1397
|
+
function fixedPriceRoute(item, currency) {
|
|
1398
|
+
const amount = item.amount;
|
|
1399
|
+
return typeof amount === "string" && /^\d+(?:\.\d+)?$/.test(amount) && Number.isFinite(Number(amount)) && Number(amount) > 0 && /^[A-Z]{3}$/.test(currency) && item.currency === currency ? "appleIap" : "decide";
|
|
1400
|
+
}
|
|
1401
|
+
function bookingAttendanceOf(raw) {
|
|
1402
|
+
const s = object(raw);
|
|
1403
|
+
const payment = object(s.payment);
|
|
1404
|
+
const fixed = object(payment.fixed);
|
|
1405
|
+
const price = object(fixed.price);
|
|
1406
|
+
const options = object(payment.options);
|
|
1407
|
+
const policy = object(object(s.bookingPolicy).participantsPolicy);
|
|
1408
|
+
return {
|
|
1409
|
+
kind: "bookingsService",
|
|
1410
|
+
type: text(s.type),
|
|
1411
|
+
capacity: numeric(s.defaultCapacity),
|
|
1412
|
+
maxParticipantsPerBooking: policy.enabled === true ? numeric(policy.maxParticipantsPerBooking) : void 0,
|
|
1413
|
+
hidden: boolean(s.hidden),
|
|
1414
|
+
conferencing: boolean(object(s.conferencing).enabled),
|
|
1415
|
+
locations: Array.isArray(s.locations) ? s.locations.map((l) => text(object(l).type) ?? "UNKNOWN") : void 0,
|
|
1416
|
+
onlineBooking: boolean(object(s.onlineBooking).enabled),
|
|
1417
|
+
onlinePayment: boolean(options.online),
|
|
1418
|
+
deposit: options.deposit === true || fixed.deposit !== void 0,
|
|
1419
|
+
priceType: text(payment.rateType),
|
|
1420
|
+
amount: text(price.value),
|
|
1421
|
+
currency: text(price.currency)
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
function ticketAttendanceOf(event, definition) {
|
|
1425
|
+
const e = object(event);
|
|
1426
|
+
const t = object(definition);
|
|
1427
|
+
const pricing = object(t.pricingMethod);
|
|
1428
|
+
const price = object(pricing.fixedPrice);
|
|
1429
|
+
const registration = object(e.registration);
|
|
1430
|
+
const type = text(registration.type) ?? text(registration.initialType) ?? text(e.eventType);
|
|
1431
|
+
const status = text(e.status) ?? text(e.eventStatus);
|
|
1432
|
+
return {
|
|
1433
|
+
kind: "eventsTicket",
|
|
1434
|
+
location: text(object(e.location).type),
|
|
1435
|
+
registration: type === "TICKETS" || type === "RSVP_AND_TICKETS" ? "TICKETING" : type,
|
|
1436
|
+
eventStatus: status === "SCHEDULED" ? "UPCOMING" : status,
|
|
1437
|
+
saleStatus: text(t.saleStatus),
|
|
1438
|
+
hidden: boolean(t.hidden),
|
|
1439
|
+
priceType: text(pricing.pricingType),
|
|
1440
|
+
amount: text(price.value),
|
|
1441
|
+
currency: text(price.currency)
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
function availableTicketAttendanceOf(event, ticket) {
|
|
1445
|
+
const e = object(event);
|
|
1446
|
+
const t = object(ticket);
|
|
1447
|
+
const pricing = object(t.pricing);
|
|
1448
|
+
const fixed = object(pricing.fixedPrice);
|
|
1449
|
+
const price = object(t.price);
|
|
1450
|
+
const visible = Array.isArray(t.state) && t.state.length === 0 && object(t.dashboard).hidden !== true && typeof t.id === "string" && t.id.length > 0 && typeof e.id === "string" && e.id.length > 0 && t.eventId === e.id;
|
|
1451
|
+
const fixedPrice = t.free === false && pricing.pricingType === "STANDARD" && sameTicketAmount(fixed.amount, price.amount) && fixed.currency === price.currency;
|
|
1452
|
+
return ticketAttendanceOf(e, {
|
|
1453
|
+
hidden: visible ? false : void 0,
|
|
1454
|
+
saleStatus: t.saleStatus,
|
|
1455
|
+
pricingMethod: { pricingType: fixedPrice ? "STANDARD" : void 0, fixedPrice: { value: fixed.amount, currency: fixed.currency } }
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
function sameTicketAmount(left, right) {
|
|
1459
|
+
const valid = (value) => typeof value === "string" && /^\d+(?:\.\d+)?$/.test(value);
|
|
1460
|
+
const normalized = (value) => value.replace(/^0+(?=\d)/, "").replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
|
|
1461
|
+
return valid(left) && valid(right) && normalized(left) === normalized(right);
|
|
1462
|
+
}
|
|
1463
|
+
function object(value) {
|
|
1464
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
1465
|
+
}
|
|
1466
|
+
var text = (value) => typeof value === "string" ? value : void 0;
|
|
1467
|
+
var numeric = (value) => typeof value === "number" ? value : void 0;
|
|
1468
|
+
var boolean = (value) => typeof value === "boolean" ? value : void 0;
|
|
1469
|
+
var zeroPrice = (value) => typeof value === "string" && /^0+(?:\.0+)?$/.test(value);
|
|
1470
|
+
|
|
1350
1471
|
// ../../core/sdk/iap/src/index.ts
|
|
1351
1472
|
async function getPaywallConfig() {
|
|
1352
1473
|
const r = await dispatch("capability.iap.getPaywallConfig");
|
|
@@ -1477,7 +1598,10 @@ function decodeTransaction(value) {
|
|
|
1477
1598
|
return { store, signedTransaction, transactionId, originalTransactionId, productId, appAccountToken, environment };
|
|
1478
1599
|
}
|
|
1479
1600
|
export {
|
|
1601
|
+
APPLE_PROVISIONING_RULES,
|
|
1480
1602
|
APPLE_SALE_RULES,
|
|
1603
|
+
BOOKINGS_APPLE_SALES_ENABLED,
|
|
1604
|
+
EVENTS_APPLE_SALES_ENABLED,
|
|
1481
1605
|
HIMALAYA_SERVE_IAP_ROUTE,
|
|
1482
1606
|
IAP_CATALOG_KINDS,
|
|
1483
1607
|
MAX_AUTOMATIC_ATTEMPTS,
|
|
@@ -1488,6 +1612,10 @@ export {
|
|
|
1488
1612
|
STORES_PRODUCT_SALE_RULE,
|
|
1489
1613
|
appleManagedStore,
|
|
1490
1614
|
appleSaleRules,
|
|
1615
|
+
attendanceCheckoutRoute,
|
|
1616
|
+
availableTicketAttendanceOf,
|
|
1617
|
+
bookingAttendanceOf,
|
|
1618
|
+
classifyForApple,
|
|
1491
1619
|
consume,
|
|
1492
1620
|
createHostSession,
|
|
1493
1621
|
createIapCatalogPricing,
|
|
@@ -1509,6 +1637,7 @@ export {
|
|
|
1509
1637
|
readIdentityBound,
|
|
1510
1638
|
restore,
|
|
1511
1639
|
sharedHostAppBindingSource,
|
|
1640
|
+
ticketAttendanceOf,
|
|
1512
1641
|
version
|
|
1513
1642
|
};
|
|
1514
1643
|
//# sourceMappingURL=iap.mjs.map
|