@meadow-studio/platform 0.0.0-stage → 0.1.1
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/MeadowPlatform.podspec +17 -0
- package/Package.swift +23 -0
- package/README.md +147 -2
- package/android/build.gradle +42 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/app/meadow/platform/MeadowAppRatingPlugin.java +38 -0
- package/dist/cli/app-skill.d.ts +3 -0
- package/dist/cli/app-skill.d.ts.map +1 -0
- package/dist/cli/app-skill.js +38 -0
- package/dist/cli/app-skill.js.map +1 -0
- package/dist/cli/commands.d.ts +74 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +1095 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/config.d.ts +123 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +428 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/inspiration.d.ts +3 -0
- package/dist/cli/inspiration.d.ts.map +1 -0
- package/dist/cli/inspiration.js +12 -0
- package/dist/cli/inspiration.js.map +1 -0
- package/dist/cli/meadow.d.ts +8 -0
- package/dist/cli/meadow.d.ts.map +1 -0
- package/dist/cli/meadow.js +466 -0
- package/dist/cli/meadow.js.map +1 -0
- package/dist/cli/product-brief.d.ts +3 -0
- package/dist/cli/product-brief.d.ts.map +1 -0
- package/dist/cli/product-brief.js +38 -0
- package/dist/cli/product-brief.js.map +1 -0
- package/dist/cli/recipes.d.ts +10 -0
- package/dist/cli/recipes.d.ts.map +1 -0
- package/dist/cli/recipes.js +575 -0
- package/dist/cli/recipes.js.map +1 -0
- package/dist/cli/sync.d.ts +14 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +310 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli/templates.d.ts +27 -0
- package/dist/cli/templates.d.ts.map +1 -0
- package/dist/cli/templates.js +1292 -0
- package/dist/cli/templates.js.map +1 -0
- package/dist/cli/website.d.ts +5 -0
- package/dist/cli/website.d.ts.map +1 -0
- package/dist/cli/website.js +262 -0
- package/dist/cli/website.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/notifications.d.ts +119 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +320 -0
- package/dist/notifications.js.map +1 -0
- package/dist/platform.d.ts +163 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +623 -0
- package/dist/platform.js.map +1 -0
- package/dist/purchases.d.ts +88 -0
- package/dist/purchases.d.ts.map +1 -0
- package/dist/purchases.js +296 -0
- package/dist/purchases.js.map +1 -0
- package/dist/ui/app-build.component.d.ts +18 -0
- package/dist/ui/app-build.component.d.ts.map +1 -0
- package/dist/ui/app-build.component.js +56 -0
- package/dist/ui/app-build.component.js.map +1 -0
- package/dist/ui/app-build.model.d.ts +11 -0
- package/dist/ui/app-build.model.d.ts.map +1 -0
- package/dist/ui/app-build.model.js +18 -0
- package/dist/ui/app-build.model.js.map +1 -0
- package/dist/ui/app-links.component.d.ts +14 -0
- package/dist/ui/app-links.component.d.ts.map +1 -0
- package/dist/ui/app-links.component.js +77 -0
- package/dist/ui/app-links.component.js.map +1 -0
- package/dist/ui/app-links.model.d.ts +18 -0
- package/dist/ui/app-links.model.d.ts.map +1 -0
- package/dist/ui/app-links.model.js +17 -0
- package/dist/ui/app-links.model.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +5 -0
- package/dist/ui/index.js.map +1 -0
- package/docs/CLI.md +389 -0
- package/docs/PLATFORM_GUIDE.md +423 -0
- package/docs/POC_FINDINGS.md +218 -0
- package/docs/PROJECT_BRIEF.md +501 -0
- package/docs/RELEASING.md +49 -0
- package/docs/V0.1_PATH.md +310 -0
- package/ios/Sources/MeadowPlatformPlugin/MeadowAppRatingPlugin.swift +39 -0
- package/package.json +89 -4
- package/schema/meadow-config.schema.json +250 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export interface MeadowPurchasesConfig {
|
|
2
|
+
readonly enabled: boolean;
|
|
3
|
+
readonly apiKeys: {
|
|
4
|
+
readonly ios?: string;
|
|
5
|
+
readonly android?: string;
|
|
6
|
+
};
|
|
7
|
+
readonly entitlementId: string;
|
|
8
|
+
readonly offeringId?: string;
|
|
9
|
+
readonly productIds?: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export interface MeadowPurchaseProduct {
|
|
12
|
+
readonly packageId: string;
|
|
13
|
+
readonly productId: string;
|
|
14
|
+
readonly title: string;
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly price: number;
|
|
17
|
+
readonly priceString: string;
|
|
18
|
+
readonly currencyCode: string;
|
|
19
|
+
readonly subscriptionPeriod: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface MeadowEntitlementState {
|
|
22
|
+
readonly active: boolean;
|
|
23
|
+
readonly entitlementId: string;
|
|
24
|
+
readonly productId: string | null;
|
|
25
|
+
readonly expirationDate: string | null;
|
|
26
|
+
readonly willRenew: boolean;
|
|
27
|
+
readonly managementUrl: string | null;
|
|
28
|
+
}
|
|
29
|
+
export type MeadowPurchaseErrorCategory = 'configuration' | 'network' | 'not_allowed' | 'product_unavailable' | 'store' | 'unknown';
|
|
30
|
+
export type MeadowPurchaseOutcome = {
|
|
31
|
+
readonly status: 'completed';
|
|
32
|
+
readonly entitlement: MeadowEntitlementState;
|
|
33
|
+
} | {
|
|
34
|
+
readonly status: 'cancelled';
|
|
35
|
+
} | {
|
|
36
|
+
readonly status: 'pending';
|
|
37
|
+
} | {
|
|
38
|
+
readonly status: 'failed';
|
|
39
|
+
readonly category: MeadowPurchaseErrorCategory;
|
|
40
|
+
};
|
|
41
|
+
export type MeadowPurchaseStatus = 'unavailable' | 'idle' | 'loading' | 'ready' | 'error';
|
|
42
|
+
export interface MeadowPurchaseTransportProduct extends MeadowPurchaseProduct {
|
|
43
|
+
/** Opaque provider value retained only by the Meadow transport boundary. */
|
|
44
|
+
readonly providerValue: unknown;
|
|
45
|
+
}
|
|
46
|
+
export interface MeadowPurchaseTransport {
|
|
47
|
+
isAvailable(): boolean;
|
|
48
|
+
configure(apiKey: string): Promise<void>;
|
|
49
|
+
loadOffering(offeringId?: string): Promise<readonly MeadowPurchaseTransportProduct[]>;
|
|
50
|
+
getEntitlement(entitlementId: string): Promise<MeadowEntitlementState>;
|
|
51
|
+
purchase(product: MeadowPurchaseTransportProduct, entitlementId: string): Promise<MeadowEntitlementState>;
|
|
52
|
+
restore(entitlementId: string): Promise<MeadowEntitlementState>;
|
|
53
|
+
getSupportId(): Promise<string | null>;
|
|
54
|
+
addEntitlementListener(entitlementId: string, listener: (state: MeadowEntitlementState) => void): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
/** Provider-neutral native purchases and entitlement state for app-owned paywalls. */
|
|
57
|
+
export declare class MeadowPurchaseService {
|
|
58
|
+
private readonly config;
|
|
59
|
+
private readonly transport;
|
|
60
|
+
private readonly productsState;
|
|
61
|
+
private readonly entitlementState;
|
|
62
|
+
private readonly statusState;
|
|
63
|
+
private readonly errorState;
|
|
64
|
+
private readonly transportProducts;
|
|
65
|
+
private initializeRequest?;
|
|
66
|
+
private productsRequest?;
|
|
67
|
+
private listenerRegistered;
|
|
68
|
+
readonly products: import("@angular/core").Signal<readonly MeadowPurchaseProduct[]>;
|
|
69
|
+
readonly entitlement: import("@angular/core").Signal<MeadowEntitlementState>;
|
|
70
|
+
readonly status: import("@angular/core").Signal<MeadowPurchaseStatus>;
|
|
71
|
+
readonly error: import("@angular/core").Signal<MeadowPurchaseErrorCategory | null>;
|
|
72
|
+
readonly isPremium: import("@angular/core").Signal<boolean>;
|
|
73
|
+
constructor(config: Readonly<MeadowPurchasesConfig> | undefined, transport?: MeadowPurchaseTransport);
|
|
74
|
+
isSupported(): boolean;
|
|
75
|
+
initialize(): Promise<boolean>;
|
|
76
|
+
loadProducts(force?: boolean): Promise<boolean>;
|
|
77
|
+
refreshEntitlement(): Promise<MeadowEntitlementState | null>;
|
|
78
|
+
purchase(packageId: string): Promise<MeadowPurchaseOutcome>;
|
|
79
|
+
restore(): Promise<MeadowPurchaseOutcome>;
|
|
80
|
+
getSupportId(): Promise<string | null>;
|
|
81
|
+
private configure;
|
|
82
|
+
private fetchProducts;
|
|
83
|
+
private applyEntitlement;
|
|
84
|
+
private requiredConfig;
|
|
85
|
+
}
|
|
86
|
+
export declare const NOOP_PURCHASE_TRANSPORT: MeadowPurchaseTransport;
|
|
87
|
+
export declare const CAPACITOR_REVENUECAT_PURCHASE_TRANSPORT: MeadowPurchaseTransport;
|
|
88
|
+
//# sourceMappingURL=purchases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purchases.d.ts","sourceRoot":"","sources":["../src/purchases.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EA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SAAS,EACnD,SAAS,GAAE,uBAAiD;IAM/E,WAAW,IAAI,OAAO;IAIhB,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAa9B,YAAY,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAS7C,kBAAkB,IAAI,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IAa5D,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA0B3D,OAAO,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAgBzC,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YAS9B,SAAS;YAuBT,aAAa;IA6B3B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,cAAc;CAIvB;AAED,eAAO,MAAM,uBAAuB,EAAE,uBAUpC,CAAC;AA2DH,eAAO,MAAM,uCAAuC,EAAE,uBAiDpD,CAAC"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { computed, signal } from '@angular/core';
|
|
2
|
+
import { Capacitor, registerPlugin } from '@capacitor/core';
|
|
3
|
+
/** Provider-neutral native purchases and entitlement state for app-owned paywalls. */
|
|
4
|
+
export class MeadowPurchaseService {
|
|
5
|
+
config;
|
|
6
|
+
transport;
|
|
7
|
+
productsState = signal([], /* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [{ debugName: "productsState" }] : /* istanbul ignore next */ []));
|
|
9
|
+
entitlementState = signal(inactiveEntitlement(''), /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "entitlementState" }] : /* istanbul ignore next */ []));
|
|
11
|
+
statusState = signal('idle', /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "statusState" }] : /* istanbul ignore next */ []));
|
|
13
|
+
errorState = signal(null, /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "errorState" }] : /* istanbul ignore next */ []));
|
|
15
|
+
transportProducts = new Map();
|
|
16
|
+
initializeRequest;
|
|
17
|
+
productsRequest;
|
|
18
|
+
listenerRegistered = false;
|
|
19
|
+
products = this.productsState.asReadonly();
|
|
20
|
+
entitlement = this.entitlementState.asReadonly();
|
|
21
|
+
status = this.statusState.asReadonly();
|
|
22
|
+
error = this.errorState.asReadonly();
|
|
23
|
+
isPremium = computed(() => this.entitlementState().active, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "isPremium" }] : /* istanbul ignore next */ []));
|
|
25
|
+
constructor(config, transport = NOOP_PURCHASE_TRANSPORT) {
|
|
26
|
+
this.config = config;
|
|
27
|
+
this.transport = transport;
|
|
28
|
+
this.entitlementState.set(inactiveEntitlement(config?.entitlementId ?? ''));
|
|
29
|
+
if (!config?.enabled || !transport.isAvailable())
|
|
30
|
+
this.statusState.set('unavailable');
|
|
31
|
+
}
|
|
32
|
+
isSupported() {
|
|
33
|
+
return this.config?.enabled === true && this.transport.isAvailable();
|
|
34
|
+
}
|
|
35
|
+
async initialize() {
|
|
36
|
+
if (!this.isSupported())
|
|
37
|
+
return false;
|
|
38
|
+
if (!this.initializeRequest) {
|
|
39
|
+
this.initializeRequest = this.configure().catch((error) => {
|
|
40
|
+
this.initializeRequest = undefined;
|
|
41
|
+
this.statusState.set('error');
|
|
42
|
+
this.errorState.set(purchaseErrorCategory(error));
|
|
43
|
+
return false;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return this.initializeRequest;
|
|
47
|
+
}
|
|
48
|
+
async loadProducts(force = false) {
|
|
49
|
+
if (this.productsState().length && !force)
|
|
50
|
+
return true;
|
|
51
|
+
if (this.productsRequest)
|
|
52
|
+
return this.productsRequest;
|
|
53
|
+
this.productsRequest = this.fetchProducts().finally(() => {
|
|
54
|
+
this.productsRequest = undefined;
|
|
55
|
+
});
|
|
56
|
+
return this.productsRequest;
|
|
57
|
+
}
|
|
58
|
+
async refreshEntitlement() {
|
|
59
|
+
if (!(await this.initialize()))
|
|
60
|
+
return null;
|
|
61
|
+
try {
|
|
62
|
+
const state = await this.transport.getEntitlement(this.requiredConfig().entitlementId);
|
|
63
|
+
this.applyEntitlement(state);
|
|
64
|
+
return state;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
this.statusState.set('error');
|
|
68
|
+
this.errorState.set(purchaseErrorCategory(error));
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async purchase(packageId) {
|
|
73
|
+
if (!(await this.initialize())) {
|
|
74
|
+
return { status: 'failed', category: this.errorState() ?? 'configuration' };
|
|
75
|
+
}
|
|
76
|
+
this.errorState.set(null);
|
|
77
|
+
if (!this.transportProducts.has(packageId) && !(await this.loadProducts())) {
|
|
78
|
+
return { status: 'failed', category: this.errorState() ?? 'product_unavailable' };
|
|
79
|
+
}
|
|
80
|
+
const product = this.transportProducts.get(packageId);
|
|
81
|
+
if (!product)
|
|
82
|
+
return { status: 'failed', category: 'product_unavailable' };
|
|
83
|
+
try {
|
|
84
|
+
const entitlement = await this.transport.purchase(product, this.requiredConfig().entitlementId);
|
|
85
|
+
this.applyEntitlement(entitlement);
|
|
86
|
+
return { status: 'completed', entitlement };
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (isCancelledPurchase(error))
|
|
90
|
+
return { status: 'cancelled' };
|
|
91
|
+
if (purchaseErrorCode(error) === '20')
|
|
92
|
+
return { status: 'pending' };
|
|
93
|
+
const category = purchaseErrorCategory(error);
|
|
94
|
+
this.errorState.set(category);
|
|
95
|
+
return { status: 'failed', category };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async restore() {
|
|
99
|
+
if (!(await this.initialize())) {
|
|
100
|
+
return { status: 'failed', category: this.errorState() ?? 'configuration' };
|
|
101
|
+
}
|
|
102
|
+
this.errorState.set(null);
|
|
103
|
+
try {
|
|
104
|
+
const entitlement = await this.transport.restore(this.requiredConfig().entitlementId);
|
|
105
|
+
this.applyEntitlement(entitlement);
|
|
106
|
+
return { status: 'completed', entitlement };
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
const category = purchaseErrorCategory(error);
|
|
110
|
+
this.errorState.set(category);
|
|
111
|
+
return { status: 'failed', category };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async getSupportId() {
|
|
115
|
+
try {
|
|
116
|
+
if (!(await this.initialize()))
|
|
117
|
+
return null;
|
|
118
|
+
return await this.transport.getSupportId();
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async configure() {
|
|
125
|
+
const config = this.requiredConfig();
|
|
126
|
+
const platform = Capacitor.getPlatform();
|
|
127
|
+
const apiKey = platform === 'ios' ? config.apiKeys.ios : config.apiKeys.android;
|
|
128
|
+
if (!apiKey?.trim())
|
|
129
|
+
throw providerError('23');
|
|
130
|
+
this.statusState.set('loading');
|
|
131
|
+
this.errorState.set(null);
|
|
132
|
+
await this.transport.configure(apiKey.trim());
|
|
133
|
+
if (!this.listenerRegistered) {
|
|
134
|
+
try {
|
|
135
|
+
await this.transport.addEntitlementListener(config.entitlementId, (state) => {
|
|
136
|
+
this.applyEntitlement(state);
|
|
137
|
+
});
|
|
138
|
+
this.listenerRegistered = true;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// Explicit refreshes, purchase results, and restores remain authoritative.
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const state = await this.transport.getEntitlement(config.entitlementId);
|
|
145
|
+
this.applyEntitlement(state);
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
async fetchProducts() {
|
|
149
|
+
if (!(await this.initialize()))
|
|
150
|
+
return false;
|
|
151
|
+
this.statusState.set('loading');
|
|
152
|
+
this.errorState.set(null);
|
|
153
|
+
try {
|
|
154
|
+
const config = this.requiredConfig();
|
|
155
|
+
const products = await this.transport.loadOffering(config.offeringId);
|
|
156
|
+
const allowed = new Set(config.productIds ?? []);
|
|
157
|
+
const filtered = allowed.size
|
|
158
|
+
? products.filter((product) => allowed.has(product.productId))
|
|
159
|
+
: products;
|
|
160
|
+
this.transportProducts.clear();
|
|
161
|
+
for (const product of filtered)
|
|
162
|
+
this.transportProducts.set(product.packageId, product);
|
|
163
|
+
this.productsState.set(Object.freeze(filtered.map(({ providerValue: _providerValue, ...product }) => Object.freeze(product))));
|
|
164
|
+
this.statusState.set('ready');
|
|
165
|
+
if (!filtered.length) {
|
|
166
|
+
this.errorState.set('product_unavailable');
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
this.statusState.set('error');
|
|
173
|
+
this.errorState.set(purchaseErrorCategory(error));
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
applyEntitlement(state) {
|
|
178
|
+
this.entitlementState.set(Object.freeze({ ...state }));
|
|
179
|
+
this.statusState.set('ready');
|
|
180
|
+
this.errorState.set(null);
|
|
181
|
+
}
|
|
182
|
+
requiredConfig() {
|
|
183
|
+
if (!this.config?.enabled)
|
|
184
|
+
throw new Error('Purchases are not configured.');
|
|
185
|
+
return this.config;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export const NOOP_PURCHASE_TRANSPORT = Object.freeze({
|
|
189
|
+
isAvailable: () => false,
|
|
190
|
+
configure: async () => undefined,
|
|
191
|
+
loadOffering: async () => [],
|
|
192
|
+
getEntitlement: async (entitlementId) => inactiveEntitlement(entitlementId),
|
|
193
|
+
purchase: async (_product, entitlementId) => inactiveEntitlement(entitlementId),
|
|
194
|
+
restore: async (entitlementId) => inactiveEntitlement(entitlementId),
|
|
195
|
+
getSupportId: async () => null,
|
|
196
|
+
addEntitlementListener: async () => undefined,
|
|
197
|
+
});
|
|
198
|
+
const NativePurchases = registerPlugin('Purchases');
|
|
199
|
+
export const CAPACITOR_REVENUECAT_PURCHASE_TRANSPORT = Object.freeze({
|
|
200
|
+
isAvailable: () => Capacitor.isNativePlatform() && ['ios', 'android'].includes(Capacitor.getPlatform()),
|
|
201
|
+
configure: (apiKey) => NativePurchases.configure({
|
|
202
|
+
apiKey,
|
|
203
|
+
entitlementVerificationMode: 'INFORMATIONAL',
|
|
204
|
+
diagnosticsEnabled: false,
|
|
205
|
+
automaticDeviceIdentifierCollectionEnabled: false,
|
|
206
|
+
}),
|
|
207
|
+
loadOffering: async (offeringId) => {
|
|
208
|
+
const response = await NativePurchases.getOfferings();
|
|
209
|
+
const offerings = 'offerings' in response ? response.offerings : response;
|
|
210
|
+
const offering = offeringId ? offerings.all[offeringId] : offerings.current;
|
|
211
|
+
if (!offering)
|
|
212
|
+
throw providerError('5');
|
|
213
|
+
return offering.availablePackages.map((aPackage) => ({
|
|
214
|
+
packageId: aPackage.identifier,
|
|
215
|
+
productId: aPackage.product.identifier,
|
|
216
|
+
title: aPackage.product.title,
|
|
217
|
+
description: aPackage.product.description,
|
|
218
|
+
price: aPackage.product.price,
|
|
219
|
+
priceString: aPackage.product.priceString,
|
|
220
|
+
currencyCode: aPackage.product.currencyCode,
|
|
221
|
+
subscriptionPeriod: aPackage.product.subscriptionPeriod,
|
|
222
|
+
providerValue: aPackage,
|
|
223
|
+
}));
|
|
224
|
+
},
|
|
225
|
+
getEntitlement: async (entitlementId) => entitlementState((await NativePurchases.getCustomerInfo()).customerInfo, entitlementId),
|
|
226
|
+
purchase: async (product, entitlementId) => entitlementState((await NativePurchases.purchasePackage({ aPackage: product.providerValue }))
|
|
227
|
+
.customerInfo, entitlementId),
|
|
228
|
+
restore: async (entitlementId) => entitlementState((await NativePurchases.restorePurchases()).customerInfo, entitlementId),
|
|
229
|
+
getSupportId: async () => {
|
|
230
|
+
const { appUserID } = await NativePurchases.getAppUserID();
|
|
231
|
+
return appUserID.trim() || null;
|
|
232
|
+
},
|
|
233
|
+
addEntitlementListener: async (entitlementId, listener) => {
|
|
234
|
+
await NativePurchases.addCustomerInfoUpdateListener((customerInfo) => {
|
|
235
|
+
listener(entitlementState(customerInfo, entitlementId));
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
function entitlementState(customerInfo, entitlementId) {
|
|
240
|
+
const entitlement = customerInfo.entitlements.active[entitlementId];
|
|
241
|
+
return Object.freeze({
|
|
242
|
+
active: entitlement?.isActive === true,
|
|
243
|
+
entitlementId,
|
|
244
|
+
productId: entitlement?.productIdentifier ?? null,
|
|
245
|
+
expirationDate: entitlement?.expirationDate ?? null,
|
|
246
|
+
willRenew: entitlement?.willRenew ?? false,
|
|
247
|
+
managementUrl: customerInfo.managementURL ?? null,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function inactiveEntitlement(entitlementId) {
|
|
251
|
+
return Object.freeze({
|
|
252
|
+
active: false,
|
|
253
|
+
entitlementId,
|
|
254
|
+
productId: null,
|
|
255
|
+
expirationDate: null,
|
|
256
|
+
willRenew: false,
|
|
257
|
+
managementUrl: null,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function purchaseErrorCode(error) {
|
|
261
|
+
if (!error || typeof error !== 'object')
|
|
262
|
+
return undefined;
|
|
263
|
+
const code = error.code;
|
|
264
|
+
return typeof code === 'string' || typeof code === 'number' ? String(code) : undefined;
|
|
265
|
+
}
|
|
266
|
+
function isCancelledPurchase(error) {
|
|
267
|
+
return (purchaseErrorCode(error) === '1' ||
|
|
268
|
+
(!!error && typeof error === 'object' && error.userCancelled === true));
|
|
269
|
+
}
|
|
270
|
+
function purchaseErrorCategory(error) {
|
|
271
|
+
switch (purchaseErrorCode(error)) {
|
|
272
|
+
case '10':
|
|
273
|
+
case '33':
|
|
274
|
+
case '35':
|
|
275
|
+
return 'network';
|
|
276
|
+
case '11':
|
|
277
|
+
case '23':
|
|
278
|
+
return 'configuration';
|
|
279
|
+
case '3':
|
|
280
|
+
case '19':
|
|
281
|
+
return 'not_allowed';
|
|
282
|
+
case '4':
|
|
283
|
+
case '5':
|
|
284
|
+
return 'product_unavailable';
|
|
285
|
+
case '2':
|
|
286
|
+
case '15':
|
|
287
|
+
case '42':
|
|
288
|
+
return 'store';
|
|
289
|
+
default:
|
|
290
|
+
return 'unknown';
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function providerError(code) {
|
|
294
|
+
return Object.assign(new Error('Purchase provider error.'), { code });
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=purchases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purchases.js","sourceRoot":"","sources":["../src/purchases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAuE5D,sFAAsF;AACtF,MAAM,OAAO,qBAAqB;IAiBb;IACA;IAjBF,aAAa,GAAG,MAAM,CAAmC,EAAE;sFAAC,CAAC;IAC7D,gBAAgB,GAAG,MAAM,CAAyB,mBAAmB,CAAC,EAAE,CAAC;yFAAC,CAAC;IAC3E,WAAW,GAAG,MAAM,CAAuB,MAAM;oFAAC,CAAC;IACnD,UAAU,GAAG,MAAM,CAAqC,IAAI;mFAAC,CAAC;IAC9D,iBAAiB,GAAG,IAAI,GAAG,EAA0C,CAAC;IAC/E,iBAAiB,CAAoB;IACrC,eAAe,CAAoB;IACnC,kBAAkB,GAAG,KAAK,CAAC;IAE1B,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;IAC3C,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;IACjD,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;IACvC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;IACrC,SAAS,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,MAAM;kFAAC,C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+
import { type MeadowAppInfo } from '../platform.js';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/** Displays normalized app version, build, and runtime information. */
|
|
4
|
+
export declare class MeadowAppBuildComponent {
|
|
5
|
+
private readonly appInfoService;
|
|
6
|
+
protected readonly appInfo: import("@angular/core").WritableSignal<Readonly<MeadowAppInfo> | null>;
|
|
7
|
+
readonly loadingLabel: import("@angular/core").InputSignal<string>;
|
|
8
|
+
readonly webLabel: import("@angular/core").InputSignal<string>;
|
|
9
|
+
readonly versionUnavailableLabel: import("@angular/core").InputSignal<string>;
|
|
10
|
+
readonly iosLabel: import("@angular/core").InputSignal<string>;
|
|
11
|
+
readonly androidLabel: import("@angular/core").InputSignal<string>;
|
|
12
|
+
protected readonly label: import("@angular/core").Signal<string>;
|
|
13
|
+
constructor();
|
|
14
|
+
private load;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MeadowAppBuildComponent, never>;
|
|
16
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MeadowAppBuildComponent, "meadow-app-build", never, { "loadingLabel": { "alias": "loadingLabel"; "required": false; "isSignal": true; }; "webLabel": { "alias": "webLabel"; "required": false; "isSignal": true; }; "versionUnavailableLabel": { "alias": "versionUnavailableLabel"; "required": false; "isSignal": true; }; "iosLabel": { "alias": "iosLabel"; "required": false; "isSignal": true; }; "androidLabel": { "alias": "androidLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=app-build.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-build.component.d.ts","sourceRoot":"","sources":["../../src/ui/app-build.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;;AAO1E,uEAAuE;AACvE,qBAmBa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgC;IAC/D,SAAS,CAAC,QAAQ,CAAC,OAAO,yEAAgD;IAE1E,QAAQ,CAAC,YAAY,8CAAkD;IACvE,QAAQ,CAAC,QAAQ,8CAA8C;IAC/D,QAAQ,CAAC,uBAAuB,8CAA6D;IAC7F,QAAQ,CAAC,QAAQ,8CAA8C;IAC/D,QAAQ,CAAC,YAAY,8CAAkD;IAEvE,SAAS,CAAC,QAAQ,CAAC,KAAK,yCASrB;;YAMW,IAAI;yCAzBP,uBAAuB;2CAAvB,uBAAuB;CA4BnC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Component, computed, inject, input, signal } from '@angular/core';
|
|
2
|
+
import { MeadowAppInfoService } from '../platform.js';
|
|
3
|
+
import { DEFAULT_MEADOW_APP_BUILD_LABELS, formatMeadowAppBuild, } from './app-build.model.js';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/** Displays normalized app version, build, and runtime information. */
|
|
6
|
+
export class MeadowAppBuildComponent {
|
|
7
|
+
appInfoService = inject(MeadowAppInfoService);
|
|
8
|
+
appInfo = signal(null, /* @ts-ignore */
|
|
9
|
+
...(ngDevMode ? [{ debugName: "appInfo" }] : /* istanbul ignore next */ []));
|
|
10
|
+
loadingLabel = input(DEFAULT_MEADOW_APP_BUILD_LABELS.loading, /* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []));
|
|
12
|
+
webLabel = input(DEFAULT_MEADOW_APP_BUILD_LABELS.web, /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "webLabel" }] : /* istanbul ignore next */ []));
|
|
14
|
+
versionUnavailableLabel = input(DEFAULT_MEADOW_APP_BUILD_LABELS.versionUnavailable, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "versionUnavailableLabel" }] : /* istanbul ignore next */ []));
|
|
16
|
+
iosLabel = input(DEFAULT_MEADOW_APP_BUILD_LABELS.ios, /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "iosLabel" }] : /* istanbul ignore next */ []));
|
|
18
|
+
androidLabel = input(DEFAULT_MEADOW_APP_BUILD_LABELS.android, /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "androidLabel" }] : /* istanbul ignore next */ []));
|
|
20
|
+
label = computed(() => {
|
|
21
|
+
const labels = {
|
|
22
|
+
loading: this.loadingLabel(),
|
|
23
|
+
web: this.webLabel(),
|
|
24
|
+
versionUnavailable: this.versionUnavailableLabel(),
|
|
25
|
+
ios: this.iosLabel(),
|
|
26
|
+
android: this.androidLabel(),
|
|
27
|
+
};
|
|
28
|
+
return formatMeadowAppBuild(this.appInfo(), labels);
|
|
29
|
+
}, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
31
|
+
constructor() {
|
|
32
|
+
void this.load();
|
|
33
|
+
}
|
|
34
|
+
async load() {
|
|
35
|
+
this.appInfo.set(await this.appInfoService.get());
|
|
36
|
+
}
|
|
37
|
+
static ɵfac = function MeadowAppBuildComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MeadowAppBuildComponent)(); };
|
|
38
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MeadowAppBuildComponent, selectors: [["meadow-app-build"]], hostVars: 1, hostBindings: function MeadowAppBuildComponent_HostBindings(rf, ctx) { if (rf & 2) {
|
|
39
|
+
i0.ɵɵattribute("aria-busy", ctx.appInfo() === null ? "true" : null);
|
|
40
|
+
} }, inputs: { loadingLabel: [1, "loadingLabel"], webLabel: [1, "webLabel"], versionUnavailableLabel: [1, "versionUnavailableLabel"], iosLabel: [1, "iosLabel"], androidLabel: [1, "androidLabel"] }, decls: 2, vars: 1, consts: [[1, "value"]], template: function MeadowAppBuildComponent_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
i0.ɵɵdomElementStart(0, "span", 0);
|
|
42
|
+
i0.ɵɵtext(1);
|
|
43
|
+
i0.ɵɵdomElementEnd();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
i0.ɵɵadvance();
|
|
46
|
+
i0.ɵɵtextInterpolate(ctx.label());
|
|
47
|
+
} }, styles: ["[_nghost-%COMP%] {\n display: inline;\n color: var(--%NS%meadow-platform-app-build-color, inherit);\n font: var(--%NS%meadow-platform-app-build-font, inherit);\n }\n\n .value[_ngcontent-%COMP%] {\n white-space: nowrap;\n }"] });
|
|
48
|
+
}
|
|
49
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MeadowAppBuildComponent, [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{ selector: 'meadow-app-build', standalone: true, template: `<span class="value">{{ label() }}</span>`, host: {
|
|
52
|
+
'[attr.aria-busy]': 'appInfo() === null ? "true" : null',
|
|
53
|
+
}, styles: ["\n :host {\n display: inline;\n color: var(--meadow-platform-app-build-color, inherit);\n font: var(--meadow-platform-app-build-font, inherit);\n }\n\n .value {\n white-space: nowrap;\n }\n "] }]
|
|
54
|
+
}], () => [], { loadingLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingLabel", required: false }] }], webLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "webLabel", required: false }] }], versionUnavailableLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "versionUnavailableLabel", required: false }] }], iosLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "iosLabel", required: false }] }], androidLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "androidLabel", required: false }] }] }); })();
|
|
55
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MeadowAppBuildComponent, { className: "MeadowAppBuildComponent", filePath: "ui/app-build.component.ts", lineNumber: 29 }); })();
|
|
56
|
+
//# sourceMappingURL=app-build.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-build.component.js","sourceRoot":"","sources":["../../src/ui/app-build.component.ts"],"names":[],"mappings":"AA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,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;iHA3BU,uBAAuB;6DAAvB,uBAAuB;wCAAvB,aAAS,KAAK,IAAI,GAAG,MACjC,GAAG,IAAI;;YAjBK,kCAAoB;YAAA,YAAa;YAAA,oBAAO;;YAApB,cAAa;YAAb,iCAAa;;;iFAgBjC,uBAAuB;cAnBnC,SAAS;2BACE,kBAAkB,cAChB,IAAI,YACN,0CAA0C,QAY9C;oBACJ,kBAAkB,EAAE,oCAAoC;iBACzD;;kFAEU,uBAAuB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MeadowAppInfo } from '../platform.js';
|
|
2
|
+
export interface MeadowAppBuildLabels {
|
|
3
|
+
readonly loading: string;
|
|
4
|
+
readonly web: string;
|
|
5
|
+
readonly versionUnavailable: string;
|
|
6
|
+
readonly ios: string;
|
|
7
|
+
readonly android: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const DEFAULT_MEADOW_APP_BUILD_LABELS: Readonly<MeadowAppBuildLabels>;
|
|
10
|
+
export declare function formatMeadowAppBuild(info: Readonly<MeadowAppInfo> | null, labels?: Readonly<MeadowAppBuildLabels>): string;
|
|
11
|
+
//# sourceMappingURL=app-build.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-build.model.d.ts","sourceRoot":"","sources":["../../src/ui/app-build.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,oBAAoB,CAMzE,CAAC;AAEH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,IAAI,EACpC,MAAM,GAAE,QAAQ,CAAC,oBAAoB,CAAmC,GACvE,MAAM,CAQR"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const DEFAULT_MEADOW_APP_BUILD_LABELS = Object.freeze({
|
|
2
|
+
loading: 'Loading app info',
|
|
3
|
+
web: 'Web preview',
|
|
4
|
+
versionUnavailable: 'Version unavailable',
|
|
5
|
+
ios: 'iOS',
|
|
6
|
+
android: 'Android',
|
|
7
|
+
});
|
|
8
|
+
export function formatMeadowAppBuild(info, labels = DEFAULT_MEADOW_APP_BUILD_LABELS) {
|
|
9
|
+
if (!info)
|
|
10
|
+
return labels.loading;
|
|
11
|
+
if (info.platform === 'web')
|
|
12
|
+
return labels.web;
|
|
13
|
+
const platform = info.platform === 'ios' ? labels.ios : labels.android;
|
|
14
|
+
const version = info.version ? `v${info.version}` : labels.versionUnavailable;
|
|
15
|
+
const build = info.buildNumber ? ` (${info.buildNumber})` : '';
|
|
16
|
+
return `${version}${build} · ${platform}`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=app-build.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-build.model.js","sourceRoot":"","sources":["../../src/ui/app-build.model.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,+BAA+B,GAAmC,MAAM,CAAC,MAAM,CAAC;IAC3F,OAAO,EAAE,kBAAkB;IAC3B,GAAG,EAAE,aAAa;IAClB,kBAAkB,EAAE,qBAAqB;IACzC,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;CACnB,CAAC,CAAC;AAEH,MAAM,UAAU,oBAAoB,CAClC,IAAoC,EACpC,SAAyC,+BAA+B;IAExE,IAAI,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC,OAAO,CAAC;IACjC,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC;IAE/C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IACvE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC;IAC9E,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,OAAO,GAAG,OAAO,GAAG,KAAK,MAAM,QAAQ,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/** Displays the configured privacy and support destinations for an app. */
|
|
3
|
+
export declare class MeadowAppLinksComponent {
|
|
4
|
+
private readonly config;
|
|
5
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
6
|
+
readonly privacyLabel: import("@angular/core").InputSignal<string>;
|
|
7
|
+
readonly supportLabel: import("@angular/core").InputSignal<string>;
|
|
8
|
+
readonly privacyUrl: import("@angular/core").InputSignal<string | null | undefined>;
|
|
9
|
+
readonly supportEmail: import("@angular/core").InputSignal<string | null | undefined>;
|
|
10
|
+
protected readonly links: import("@angular/core").Signal<readonly Readonly<import("./app-links.model.js").MeadowAppLink>[]>;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MeadowAppLinksComponent, never>;
|
|
12
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MeadowAppLinksComponent, "meadow-app-links", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "privacyLabel": { "alias": "privacyLabel"; "required": false; "isSignal": true; }; "supportLabel": { "alias": "supportLabel"; "required": false; "isSignal": true; }; "privacyUrl": { "alias": "privacyUrl"; "required": false; "isSignal": true; }; "supportEmail": { "alias": "supportEmail"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=app-links.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-links.component.d.ts","sourceRoot":"","sources":["../../src/ui/app-links.component.ts"],"names":[],"mappings":";AAQA,2EAA2E;AAC3E,qBA2Ca,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAEzD,QAAQ,CAAC,SAAS,8CAA4B;IAC9C,QAAQ,CAAC,YAAY,8CAAiD;IACtE,QAAQ,CAAC,YAAY,8CAAiD;IACtE,QAAQ,CAAC,UAAU,iEAA+C;IAClE,QAAQ,CAAC,YAAY,iEAA+C;IAEpE,SAAS,CAAC,QAAQ,CAAC,KAAK,oGASrB;yCAlBQ,uBAAuB;2CAAvB,uBAAuB;CAmBnC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Component, computed, inject, input } from '@angular/core';
|
|
2
|
+
import { MEADOW_PLATFORM_CONFIG } from '../platform.js';
|
|
3
|
+
import { DEFAULT_MEADOW_APP_LINK_LABELS, meadowAppLinks, } from './app-links.model.js';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
const _forTrack0 = ($index, $item) => $item.kind;
|
|
6
|
+
function MeadowAppLinksComponent_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
7
|
+
i0.ɵɵdomElementStart(0, "a", 0);
|
|
8
|
+
i0.ɵɵtext(1);
|
|
9
|
+
i0.ɵɵdomElementEnd();
|
|
10
|
+
} if (rf & 2) {
|
|
11
|
+
const link_r1 = ctx.$implicit;
|
|
12
|
+
i0.ɵɵdomProperty("href", link_r1.href, i0.ɵɵsanitizeUrl);
|
|
13
|
+
i0.ɵɵattribute("target", link_r1.kind === "privacy" ? "_blank" : null)("rel", link_r1.kind === "privacy" ? "noopener noreferrer" : null);
|
|
14
|
+
i0.ɵɵadvance();
|
|
15
|
+
i0.ɵɵtextInterpolate1(" ", link_r1.label, " ");
|
|
16
|
+
} }
|
|
17
|
+
function MeadowAppLinksComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
+
i0.ɵɵdomElementStart(0, "nav");
|
|
19
|
+
i0.ɵɵrepeaterCreate(1, MeadowAppLinksComponent_Conditional_0_For_2_Template, 2, 4, "a", 0, _forTrack0);
|
|
20
|
+
i0.ɵɵdomElementEnd();
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
23
|
+
i0.ɵɵattribute("aria-label", ctx_r1.ariaLabel());
|
|
24
|
+
i0.ɵɵadvance();
|
|
25
|
+
i0.ɵɵrepeater(ctx_r1.links());
|
|
26
|
+
} }
|
|
27
|
+
/** Displays the configured privacy and support destinations for an app. */
|
|
28
|
+
export class MeadowAppLinksComponent {
|
|
29
|
+
config = inject(MEADOW_PLATFORM_CONFIG);
|
|
30
|
+
ariaLabel = input('App information', /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
32
|
+
privacyLabel = input(DEFAULT_MEADOW_APP_LINK_LABELS.privacy, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "privacyLabel" }] : /* istanbul ignore next */ []));
|
|
34
|
+
supportLabel = input(DEFAULT_MEADOW_APP_LINK_LABELS.support, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "supportLabel" }] : /* istanbul ignore next */ []));
|
|
36
|
+
privacyUrl = input(undefined, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "privacyUrl" }] : /* istanbul ignore next */ []));
|
|
38
|
+
supportEmail = input(undefined, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "supportEmail" }] : /* istanbul ignore next */ []));
|
|
40
|
+
links = computed(() => {
|
|
41
|
+
const labels = {
|
|
42
|
+
privacy: this.privacyLabel(),
|
|
43
|
+
support: this.supportLabel(),
|
|
44
|
+
};
|
|
45
|
+
return meadowAppLinks(this.config.app, labels, {
|
|
46
|
+
privacyUrl: this.privacyUrl(),
|
|
47
|
+
supportEmail: this.supportEmail(),
|
|
48
|
+
});
|
|
49
|
+
}, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "links" }] : /* istanbul ignore next */ []));
|
|
51
|
+
static ɵfac = function MeadowAppLinksComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MeadowAppLinksComponent)(); };
|
|
52
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MeadowAppLinksComponent, selectors: [["meadow-app-links"]], inputs: { ariaLabel: [1, "ariaLabel"], privacyLabel: [1, "privacyLabel"], supportLabel: [1, "supportLabel"], privacyUrl: [1, "privacyUrl"], supportEmail: [1, "supportEmail"] }, decls: 1, vars: 1, consts: [[3, "href"]], template: function MeadowAppLinksComponent_Template(rf, ctx) { if (rf & 1) {
|
|
53
|
+
i0.ɵɵconditionalCreate(0, MeadowAppLinksComponent_Conditional_0_Template, 3, 1, "nav");
|
|
54
|
+
} if (rf & 2) {
|
|
55
|
+
i0.ɵɵconditional(ctx.links().length ? 0 : -1);
|
|
56
|
+
} }, styles: ["[_nghost-%COMP%] {\n display: block;\n }\n\n nav[_ngcontent-%COMP%] {\n display: flex;\n flex-wrap: wrap;\n gap: var(--%NS%meadow-platform-app-links-gap, 0.75rem 1rem);\n }\n\n a[_ngcontent-%COMP%] {\n color: var(--%NS%meadow-platform-app-links-color, currentColor);\n font: var(--%NS%meadow-platform-app-links-font, inherit);\n text-underline-offset: 0.2em;\n }\n\n a[_ngcontent-%COMP%]:focus-visible {\n border-radius: 0.2rem;\n outline: var(--%NS%meadow-platform-focus-width, 3px) solid\n var(--%NS%meadow-platform-focus-color, currentColor);\n outline-offset: var(--%NS%meadow-platform-focus-offset, 2px);\n }"] });
|
|
57
|
+
}
|
|
58
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MeadowAppLinksComponent, [{
|
|
59
|
+
type: Component,
|
|
60
|
+
args: [{ selector: 'meadow-app-links', standalone: true, template: `
|
|
61
|
+
@if (links().length) {
|
|
62
|
+
<nav [attr.aria-label]="ariaLabel()">
|
|
63
|
+
@for (link of links(); track link.kind) {
|
|
64
|
+
<a
|
|
65
|
+
[href]="link.href"
|
|
66
|
+
[attr.target]="link.kind === 'privacy' ? '_blank' : null"
|
|
67
|
+
[attr.rel]="link.kind === 'privacy' ? 'noopener noreferrer' : null"
|
|
68
|
+
>
|
|
69
|
+
{{ link.label }}
|
|
70
|
+
</a>
|
|
71
|
+
}
|
|
72
|
+
</nav>
|
|
73
|
+
}
|
|
74
|
+
`, styles: ["\n :host {\n display: block;\n }\n\n nav {\n display: flex;\n flex-wrap: wrap;\n gap: var(--meadow-platform-app-links-gap, 0.75rem 1rem);\n }\n\n a {\n color: var(--meadow-platform-app-links-color, currentColor);\n font: var(--meadow-platform-app-links-font, inherit);\n text-underline-offset: 0.2em;\n }\n\n a:focus-visible {\n border-radius: 0.2rem;\n outline: var(--meadow-platform-focus-width, 3px) solid\n var(--meadow-platform-focus-color, currentColor);\n outline-offset: var(--meadow-platform-focus-offset, 2px);\n }\n "] }]
|
|
75
|
+
}], null, { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], privacyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "privacyLabel", required: false }] }], supportLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "supportLabel", required: false }] }], privacyUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "privacyUrl", required: false }] }], supportEmail: [{ type: i0.Input, args: [{ isSignal: true, alias: "supportEmail", required: false }] }] }); })();
|
|
76
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MeadowAppLinksComponent, { className: "MeadowAppLinksComponent", filePath: "ui/app-links.component.ts", lineNumber: 53 }); })();
|
|
77
|
+
//# sourceMappingURL=app-links.component.js.map
|