@agnostack/next-shopify 1.7.0-alpha.4 → 1.7.0-alpha.41
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/handlers/api.js +21 -8
- package/dist/handlers/api.js.map +1 -1
- package/dist/handlers/ssr.d.ts +1 -1
- package/dist/handlers/ssr.js +14 -15
- package/dist/handlers/ssr.js.map +1 -1
- package/dist/helpers/auth.d.ts +1 -9
- package/dist/helpers/auth.js +11 -11
- package/dist/helpers/auth.js.map +1 -1
- package/dist/helpers/callback.d.ts +1 -1
- package/dist/helpers/callback.js +29 -19
- package/dist/helpers/callback.js.map +1 -1
- package/dist/helpers/graph.d.ts +1 -1
- package/dist/helpers/graph.js +3 -6
- package/dist/helpers/graph.js.map +1 -1
- package/dist/helpers/rest.js +6 -9
- package/dist/helpers/rest.js.map +1 -1
- package/dist/helpers/uninstall.js +10 -17
- package/dist/helpers/uninstall.js.map +1 -1
- package/dist/utils/billing.d.ts +11 -20
- package/dist/utils/billing.js +54 -192
- package/dist/utils/billing.js.map +1 -1
- package/dist/utils/constants.d.ts +4 -5
- package/dist/utils/constants.js +4 -72
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/display.d.ts +4 -1
- package/dist/utils/display.js +25 -1
- package/dist/utils/display.js.map +1 -1
- package/dist/utils/firebase.d.ts +13 -6
- package/dist/utils/firebase.js +70 -41
- package/dist/utils/firebase.js.map +1 -1
- package/dist/utils/session.d.ts +16 -11
- package/dist/utils/session.js +52 -43
- package/dist/utils/session.js.map +1 -1
- package/dist/utils/shopify-api-node/beginAuth.js +3 -3
- package/dist/utils/shopify-api-node/beginAuth.js.map +1 -1
- package/dist/utils/shopify.d.ts +2 -3
- package/dist/utils/shopify.js +49 -32
- package/dist/utils/shopify.js.map +1 -1
- package/dist/withShopify.js +15 -22
- package/dist/withShopify.js.map +1 -1
- package/package.json +2 -1
- package/CHANGELOG.md +0 -483
package/dist/utils/billing.js
CHANGED
|
@@ -1,209 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generatePaymentConfig = exports.
|
|
3
|
+
exports.generatePaymentConfig = exports.ensureBilling = void 0;
|
|
4
4
|
const shopify_api_1 = require("@shopify/shopify-api");
|
|
5
5
|
const display_1 = require("./display");
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.appId = APP_ID;
|
|
23
|
-
this.appBaseUrl = APP_BASE_URL;
|
|
24
|
-
this.paymentConfig = display_1.ensureObject(PAYMENT_CONFIG);
|
|
25
|
-
this.isRecurring = constants_1.RECURRING_INTERVALS.includes(this.paymentConfig.type);
|
|
26
|
-
}
|
|
27
|
-
async ensureBilling() {
|
|
28
|
-
var _a;
|
|
29
|
-
try {
|
|
30
|
-
if (await this.hasActivePayment()) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
return this.requestPayment();
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
if (error instanceof shopify_api_1.GraphqlQueryError) {
|
|
37
|
-
throw new shopify_api_1.BillingError({
|
|
38
|
-
message: 'Failed to verify or initialize payment',
|
|
39
|
-
errorData: display_1.ensureArray((_a = error.response) === null || _a === void 0 ? void 0 : _a.errors).map(({ message }) => display_1.ensureString(message)),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async hasActiveRecurringPayment() {
|
|
46
|
-
var _a, _b, _c;
|
|
47
|
-
const currentInstallations = await this.graphClient.query({
|
|
48
|
-
data: constants_1.RECURRING_PURCHASES_QUERY,
|
|
7
|
+
const hasValidBilling = (session, paymentConfig) => {
|
|
8
|
+
var _a;
|
|
9
|
+
return (display_1.stringNotEmpty(session === null || session === void 0 ? void 0 : session.shop) &&
|
|
10
|
+
display_1.stringNotEmpty(session === null || session === void 0 ? void 0 : session.accessToken) &&
|
|
11
|
+
display_1.stringNotEmpty(paymentConfig === null || paymentConfig === void 0 ? void 0 : paymentConfig.name) &&
|
|
12
|
+
display_1.objectNotEmpty(paymentConfig === null || paymentConfig === void 0 ? void 0 : paymentConfig.config) &&
|
|
13
|
+
Object.values(constants_1.BILLING_INTERVALS).includes((_a = paymentConfig === null || paymentConfig === void 0 ? void 0 : paymentConfig.config) === null || _a === void 0 ? void 0 : _a.interval));
|
|
14
|
+
};
|
|
15
|
+
// TODO: minor update to handle if no paymentConfig or !paymentConfig.req'd return undefined??
|
|
16
|
+
const ensureBilling = async (shopify, session, paymentConfig) => {
|
|
17
|
+
console.log(`>>> ~ ensureBilling paymentConfig`, paymentConfig);
|
|
18
|
+
console.log(`>>> ~ ensureBilling session`, session);
|
|
19
|
+
if (!hasValidBilling(session, paymentConfig)) {
|
|
20
|
+
throw new shopify_api_1.BillingError({
|
|
21
|
+
message: 'Invalid billing configuration',
|
|
49
22
|
});
|
|
50
|
-
const subscriptions = (_c = (_b = (_a = currentInstallations === null || currentInstallations === void 0 ? void 0 : currentInstallations.body) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.currentAppInstallation) === null || _c === void 0 ? void 0 : _c.activeSubscriptions;
|
|
51
|
-
const matchingSubscription = display_1.ensureArray(subscriptions).find((node) => (((node === null || node === void 0 ? void 0 : node.name) === this.paymentConfig.name)
|
|
52
|
-
&& (!display_1.isTrue(node === null || node === void 0 ? void 0 : node.test) || this.paymentConfig.test)
|
|
53
|
-
// ORIG && (isTrue(chargeTest) === this.paymentConfig.test)
|
|
54
|
-
));
|
|
55
|
-
return display_1.objectNotEmpty(matchingSubscription);
|
|
56
23
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
const purchases = (_c = (_b = (_a = currentInstallations === null || currentInstallations === void 0 ? void 0 : currentInstallations.body) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.currentAppInstallation) === null || _c === void 0 ? void 0 : _c.oneTimePurchases;
|
|
66
|
-
const matchingPurchase = display_1.ensureArray(purchases === null || purchases === void 0 ? void 0 : purchases.edges).find(({ node } = {}) => {
|
|
67
|
-
if (((node === null || node === void 0 ? void 0 : node.name) === this.paymentConfig.name) && ((node === null || node === void 0 ? void 0 : node.status) === 'ACTIVE')) {
|
|
68
|
-
console.log(`>>> ~ node`, {
|
|
69
|
-
node,
|
|
70
|
-
truish: (!display_1.isTrue(node === null || node === void 0 ? void 0 : node.test) || this.paymentConfig.test),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return (((node === null || node === void 0 ? void 0 : node.name) === this.paymentConfig.name)
|
|
74
|
-
&& ((node === null || node === void 0 ? void 0 : node.status) === 'ACTIVE')
|
|
75
|
-
&& (!display_1.isTrue(node === null || node === void 0 ? void 0 : node.test) || this.paymentConfig.test)
|
|
76
|
-
// ORIG && (isTrue(node?.test) === this.paymentConfig.test)
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
if (display_1.objectNotEmpty(matchingPurchase)) {
|
|
80
|
-
return true;
|
|
24
|
+
try {
|
|
25
|
+
if (display_1.isTrue(await shopify.billing.check({
|
|
26
|
+
plans: [paymentConfig.name],
|
|
27
|
+
isTest: display_1.isTrue(paymentConfig.test),
|
|
28
|
+
session,
|
|
29
|
+
}))) {
|
|
30
|
+
return undefined;
|
|
81
31
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
async hasActivePayment() {
|
|
88
|
-
if (this.isRecurring) {
|
|
89
|
-
return this.hasActiveRecurringPayment();
|
|
90
|
-
}
|
|
91
|
-
return this.hasActiveOneTimePayment();
|
|
92
|
-
}
|
|
93
|
-
async requestPayment() {
|
|
94
|
-
// TODO: explore objectToQuerystring
|
|
95
|
-
const queryParams = [
|
|
96
|
-
`shop=${this.shop}`,
|
|
97
|
-
`host=${Buffer.from(`${this.shop}/admin`).toString('base64')}`
|
|
98
|
-
];
|
|
99
|
-
const returnUrl = `${this.appBaseUrl}?${queryParams.join('&')}`;
|
|
100
|
-
const data = this.isRecurring
|
|
101
|
-
? await this.requestRecurringPayment(returnUrl)
|
|
102
|
-
: await this.requestSinglePayment(returnUrl);
|
|
103
|
-
if (display_1.arrayNotEmpty(data === null || data === void 0 ? void 0 : data.userErrors)) {
|
|
104
|
-
throw new shopify_api_1.BillingError({
|
|
105
|
-
message: 'User error requesting payment',
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
return data === null || data === void 0 ? void 0 : data.confirmationUrl;
|
|
109
|
-
}
|
|
110
|
-
async requestSinglePayment(returnUrl) {
|
|
111
|
-
var _a, _b, _c, _d;
|
|
112
|
-
const { price, name, test, } = this.paymentConfig;
|
|
113
|
-
const mutationResponse = await this.graphClient.query({
|
|
114
|
-
data: {
|
|
115
|
-
query: constants_1.ONE_TIME_PURCHASE_MUTATION,
|
|
116
|
-
variables: {
|
|
117
|
-
test,
|
|
118
|
-
name,
|
|
119
|
-
price,
|
|
120
|
-
returnUrl,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
32
|
+
return shopify.billing.request({
|
|
33
|
+
plan: paymentConfig.name,
|
|
34
|
+
isTest: display_1.isTrue(paymentConfig.test),
|
|
35
|
+
session,
|
|
123
36
|
});
|
|
124
|
-
if (((_a = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _a === void 0 ? void 0 : _a.errors) && display_1.arrayNotEmpty((_b = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _b === void 0 ? void 0 : _b.errors)) {
|
|
125
|
-
throw new shopify_api_1.BillingError({
|
|
126
|
-
message: 'Error executing one-time purchase',
|
|
127
|
-
errorData: display_1.ensureArray(mutationResponse.body.errors).map(({ message }) => display_1.ensureString(message)).join('. '),
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return (_d = (_c = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.appPurchaseOneTimeCreate;
|
|
131
37
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const mutationResponse = await this.graphClient.query({
|
|
136
|
-
data: {
|
|
137
|
-
query: constants_1.RECURRING_PURCHASE_MUTATION,
|
|
138
|
-
variables: {
|
|
139
|
-
test,
|
|
140
|
-
name,
|
|
141
|
-
returnUrl,
|
|
142
|
-
lineItems: [{
|
|
143
|
-
plan: {
|
|
144
|
-
appRecurringPricingDetails: {
|
|
145
|
-
interval,
|
|
146
|
-
price,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
}],
|
|
150
|
-
},
|
|
151
|
-
},
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw new shopify_api_1.BillingError({
|
|
40
|
+
message: 'Failed to verify or initialize payment',
|
|
152
41
|
});
|
|
153
|
-
if (((_a = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _a === void 0 ? void 0 : _a.errors) && display_1.arrayNotEmpty((_b = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _b === void 0 ? void 0 : _b.errors)) {
|
|
154
|
-
throw new shopify_api_1.BillingError({
|
|
155
|
-
message: 'Error executing recurring purchase',
|
|
156
|
-
errorData: display_1.ensureArray(mutationResponse.body.errors).map(({ message }) => display_1.ensureString(message)).join('. '),
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return (_d = (_c = mutationResponse === null || mutationResponse === void 0 ? void 0 : mutationResponse.body) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.appSubscriptionCreate;
|
|
160
42
|
}
|
|
161
|
-
}
|
|
162
|
-
exports.
|
|
163
|
-
// TODO enable billing management
|
|
43
|
+
};
|
|
44
|
+
exports.ensureBilling = ensureBilling;
|
|
164
45
|
// eslint-disable-next-line arrow-body-style
|
|
165
|
-
const generatePaymentConfig = () => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
} = ensureObject(paymentConfig)
|
|
174
|
-
const { debugMode, environment } = ensureObject(data)
|
|
175
|
-
|
|
176
|
-
if (objectEmpty(paymentConfig) || stringEmpty(environment)) {
|
|
177
|
-
return undefined
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const notProduction = (environment !== 'production')
|
|
181
|
-
|
|
182
|
-
// TODO ensure this logic is correct
|
|
183
|
-
let test = environment !== 'production'
|
|
184
|
-
if (debugMode) {
|
|
185
|
-
test = true
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const _paymentConfig = {
|
|
189
|
-
type,
|
|
190
|
-
required: (environment !== 'development'),
|
|
191
|
-
test,
|
|
192
|
-
name: `${name}${notProduction ? ` - ${environment}` : ''} - ${unsnakecase(type)}`,
|
|
193
|
-
price: {
|
|
194
|
-
amount: price,
|
|
195
|
-
currencyCode: currency,
|
|
196
|
-
},
|
|
46
|
+
const generatePaymentConfig = (data) => {
|
|
47
|
+
const {
|
|
48
|
+
// debugMode,
|
|
49
|
+
environment, paymentConfig,
|
|
50
|
+
// SHOPIFY_RUN_MODE,
|
|
51
|
+
} = display_1.ensureObject(data);
|
|
52
|
+
if (display_1.objectEmpty(paymentConfig) || display_1.stringEmpty(environment)) {
|
|
53
|
+
return undefined;
|
|
197
54
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
55
|
+
const { name, price, currency = 'USD', type = constants_1.BILLING_INTERVALS.ONE_TIME, } = display_1.ensureObject(paymentConfig);
|
|
56
|
+
const isProduction = (environment === 'production');
|
|
57
|
+
const notProduction = !isProduction;
|
|
58
|
+
const billingName = `${name}${notProduction ? ` - ${environment}` : ''} - ${display_1.unsnakecase(type)}`;
|
|
59
|
+
return {
|
|
60
|
+
required: true,
|
|
61
|
+
test: true,
|
|
62
|
+
name: billingName,
|
|
63
|
+
config: {
|
|
64
|
+
interval: type,
|
|
65
|
+
amount: price,
|
|
66
|
+
currencyCode: currency,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
207
69
|
};
|
|
208
70
|
exports.generatePaymentConfig = generatePaymentConfig;
|
|
209
71
|
//# sourceMappingURL=billing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/utils/billing.js"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/utils/billing.js"],"names":[],"mappings":";;;AAAA,sDAAmD;AAEnD,uCAQkB;AAClB,2CAA+C;AAE/C,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE;;IAAC,OAAA,CAClD,wBAAc,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC;QAC7B,wBAAc,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAC;QACpC,wBAAc,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,CAAC;QACnC,wBAAc,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,6BAAiB,CAAC,CAAC,QAAQ,CAAC,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,0CAAE,QAAQ,CAAC,CAC3E,CAAA;CAAA,CAAA;AAED,8FAA8F;AACvF,MAAM,aAAa,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ChB,IAAI,GAAG,6BAAiB,CAAC,QAAQ,GAClC,GAAG,sBAAY,CAAC,aAAa,CAAC,CAAA;IAE/B,MAAM,YAAY,GAAG,CAAC,WAAW,KAAK,YAAY,CAAC,CAAA;IACnD,MAAM,aAAa,GAAG,CAAC,YAAY,CAAA;IACnC,MAAM,WAAW,GAAG,GAAG,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,qBAAW,CAAC,IAAI,CAAC,EAAE,CAAA;IAE/F,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE;YACN,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,QAAQ;SACvB;KACF,CAAA;AACH,CAAC,CAAA;AAjCY,QAAA,qBAAqB,yBAiCjC"}
|
|
@@ -8,14 +8,13 @@ export namespace API_ROUTE_NAMES {
|
|
|
8
8
|
const AUTH_CALLBACK: string;
|
|
9
9
|
const APP_UNINSTALLED: string;
|
|
10
10
|
}
|
|
11
|
+
export namespace API_WEBHOOK_TOPICS {
|
|
12
|
+
const APP_UNINSTALLED_1: string;
|
|
13
|
+
export { APP_UNINSTALLED_1 as APP_UNINSTALLED };
|
|
14
|
+
}
|
|
11
15
|
export namespace BILLING_INTERVALS {
|
|
12
16
|
const ONE_TIME: string;
|
|
13
17
|
const EVERY_30_DAYS: string;
|
|
14
18
|
const ANNUAL: string;
|
|
15
19
|
}
|
|
16
|
-
export const RECURRING_INTERVALS: string[];
|
|
17
20
|
export const SHOP_QUERY: "\n {\n shop {\n name\n }\n }\n";
|
|
18
|
-
export const RECURRING_PURCHASES_QUERY: "\n query appSubscription {\n currentAppInstallation {\n activeSubscriptions {\n name, test\n }\n }\n }\n";
|
|
19
|
-
export const ONE_TIME_PURCHASES_QUERY: "\n query appPurchases($endCursor: String) {\n currentAppInstallation {\n oneTimePurchases(first: 250, sortKey: CREATED_AT, after: $endCursor) {\n edges {\n node {\n name, test, status\n }\n }\n pageInfo {\n hasNextPage, endCursor\n }\n }\n }\n }\n";
|
|
20
|
-
export const RECURRING_PURCHASE_MUTATION: "\n mutation test(\n $name: String!\n $lineItems: [AppSubscriptionLineItemInput!]!\n $returnUrl: URL!\n $test: Boolean\n ) {\n appSubscriptionCreate(\n name: $name\n lineItems: $lineItems\n returnUrl: $returnUrl\n test: $test\n ) {\n confirmationUrl\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
21
|
-
export const ONE_TIME_PURCHASE_MUTATION: "\n mutation test(\n $name: String!\n $price: MoneyInput!\n $returnUrl: URL!\n $test: Boolean\n ) {\n appPurchaseOneTimeCreate(\n name: $name\n price: $price\n returnUrl: $returnUrl\n test: $test\n ) {\n confirmationUrl\n userErrors {\n field\n message\n }\n }\n }\n";
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SHOP_QUERY = exports.BILLING_INTERVALS = exports.API_WEBHOOK_TOPICS = exports.API_ROUTE_NAMES = exports.PAGE_ROUTE_NAMES = exports.COLLECTION_ROOT = void 0;
|
|
4
4
|
exports.COLLECTION_ROOT = 'oauth-data';
|
|
5
5
|
exports.PAGE_ROUTE_NAMES = {
|
|
6
6
|
EXIT: 'pageRouteExit',
|
|
@@ -11,15 +11,14 @@ exports.API_ROUTE_NAMES = {
|
|
|
11
11
|
AUTH_CALLBACK: 'apiRouteAuthCallback',
|
|
12
12
|
APP_UNINSTALLED: 'apiRouteAppUninstalled',
|
|
13
13
|
};
|
|
14
|
+
exports.API_WEBHOOK_TOPICS = {
|
|
15
|
+
APP_UNINSTALLED: 'APP_UNINSTALLED',
|
|
16
|
+
};
|
|
14
17
|
exports.BILLING_INTERVALS = {
|
|
15
18
|
ONE_TIME: 'ONE_TIME',
|
|
16
19
|
EVERY_30_DAYS: 'EVERY_30_DAYS',
|
|
17
20
|
ANNUAL: 'ANNUAL',
|
|
18
21
|
};
|
|
19
|
-
exports.RECURRING_INTERVALS = [
|
|
20
|
-
exports.BILLING_INTERVALS.EVERY_30_DAYS,
|
|
21
|
-
exports.BILLING_INTERVALS.ANNUAL
|
|
22
|
-
];
|
|
23
22
|
// TODO can we remove?
|
|
24
23
|
/*
|
|
25
24
|
export const SHOP_DATA_QUERY = `
|
|
@@ -66,71 +65,4 @@ exports.SHOP_QUERY = `
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
`;
|
|
69
|
-
exports.RECURRING_PURCHASES_QUERY = `
|
|
70
|
-
query appSubscription {
|
|
71
|
-
currentAppInstallation {
|
|
72
|
-
activeSubscriptions {
|
|
73
|
-
name, test
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
78
|
-
exports.ONE_TIME_PURCHASES_QUERY = `
|
|
79
|
-
query appPurchases($endCursor: String) {
|
|
80
|
-
currentAppInstallation {
|
|
81
|
-
oneTimePurchases(first: 250, sortKey: CREATED_AT, after: $endCursor) {
|
|
82
|
-
edges {
|
|
83
|
-
node {
|
|
84
|
-
name, test, status
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
pageInfo {
|
|
88
|
-
hasNextPage, endCursor
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
`;
|
|
94
|
-
exports.RECURRING_PURCHASE_MUTATION = `
|
|
95
|
-
mutation test(
|
|
96
|
-
$name: String!
|
|
97
|
-
$lineItems: [AppSubscriptionLineItemInput!]!
|
|
98
|
-
$returnUrl: URL!
|
|
99
|
-
$test: Boolean
|
|
100
|
-
) {
|
|
101
|
-
appSubscriptionCreate(
|
|
102
|
-
name: $name
|
|
103
|
-
lineItems: $lineItems
|
|
104
|
-
returnUrl: $returnUrl
|
|
105
|
-
test: $test
|
|
106
|
-
) {
|
|
107
|
-
confirmationUrl
|
|
108
|
-
userErrors {
|
|
109
|
-
field
|
|
110
|
-
message
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
`;
|
|
115
|
-
exports.ONE_TIME_PURCHASE_MUTATION = `
|
|
116
|
-
mutation test(
|
|
117
|
-
$name: String!
|
|
118
|
-
$price: MoneyInput!
|
|
119
|
-
$returnUrl: URL!
|
|
120
|
-
$test: Boolean
|
|
121
|
-
) {
|
|
122
|
-
appPurchaseOneTimeCreate(
|
|
123
|
-
name: $name
|
|
124
|
-
price: $price
|
|
125
|
-
returnUrl: $returnUrl
|
|
126
|
-
test: $test
|
|
127
|
-
) {
|
|
128
|
-
confirmationUrl
|
|
129
|
-
userErrors {
|
|
130
|
-
field
|
|
131
|
-
message
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
`;
|
|
136
68
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.js"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,YAAY,CAAA;AAE9B,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,gBAAgB;CACxB,CAAA;AAEY,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,cAAc;IACpB,aAAa,EAAE,sBAAsB;IACrC,eAAe,EAAE,wBAAwB;CAC1C,CAAA;AAEY,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;CACjB,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.js"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,YAAY,CAAA;AAE9B,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,gBAAgB;CACxB,CAAA;AAEY,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,cAAc;IACpB,aAAa,EAAE,sBAAsB;IACrC,eAAe,EAAE,wBAAwB;CAC1C,CAAA;AAEY,QAAA,kBAAkB,GAAG;IAChC,eAAe,EAAE,iBAAiB;CACnC,CAAA;AAEY,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;CACjB,CAAA;AAED,sBAAsB;AACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCE;AAEW,QAAA,UAAU,GAAG;;;;;;CAMzB,CAAA"}
|
package/dist/utils/display.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function getGUID(): any;
|
|
2
2
|
export function getInteger(): any;
|
|
3
3
|
export function querystringToObject(queryString: any): {
|
|
4
|
-
[k: string]:
|
|
4
|
+
[k: string]: string;
|
|
5
5
|
};
|
|
6
6
|
export function isType(value: any, type: any): boolean;
|
|
7
7
|
export function ensureObject(object: any): any;
|
|
@@ -17,3 +17,6 @@ export function arrayNotEmpty(array: any, disableEmptyString?: boolean): boolean
|
|
|
17
17
|
export function isTrue(value: any, falsy: any): boolean;
|
|
18
18
|
export function unsnakecase(string: any, replacement?: string): string;
|
|
19
19
|
export function cleanObject(object: any, allowEmptyLeafs: any, isEmptyCallback: any): any;
|
|
20
|
+
export function safeTrim(value: any): any;
|
|
21
|
+
export function splitCommas(value: any): any[];
|
|
22
|
+
export function arrayIncludesAll(_values: any, comparison: any): boolean;
|
package/dist/utils/display.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cleanObject = exports.unsnakecase = exports.isTrue = exports.arrayNotEmpty = exports.arrayEmpty = exports.stringEmpty = exports.stringNotEmpty = exports.objectNotEmpty = exports.objectEmpty = exports.ensureNumeric = exports.ensureArray = exports.ensureString = exports.ensureObject = exports.isType = exports.querystringToObject = exports.getInteger = exports.getGUID = void 0;
|
|
3
|
+
exports.arrayIncludesAll = exports.splitCommas = exports.safeTrim = exports.cleanObject = exports.unsnakecase = exports.isTrue = exports.arrayNotEmpty = exports.arrayEmpty = exports.stringEmpty = exports.stringNotEmpty = exports.objectNotEmpty = exports.objectEmpty = exports.ensureNumeric = exports.ensureArray = exports.ensureString = exports.ensureObject = exports.isType = exports.querystringToObject = exports.getInteger = exports.getGUID = void 0;
|
|
4
4
|
/* eslint-disable no-use-before-define */
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
6
|
const getGUID = () => (uuid_1.v4());
|
|
@@ -74,4 +74,28 @@ const cleanObject = (object, allowEmptyLeafs, isEmptyCallback) => (Object.entrie
|
|
|
74
74
|
return Object.assign(Object.assign({}, _cleanedObject), { [key]: value });
|
|
75
75
|
}, {}));
|
|
76
76
|
exports.cleanObject = cleanObject;
|
|
77
|
+
const safeTrim = (value) => {
|
|
78
|
+
if (exports.isType(value, 'string')) {
|
|
79
|
+
// eslint-disable-next-line no-param-reassign
|
|
80
|
+
value = value.trim();
|
|
81
|
+
}
|
|
82
|
+
return value;
|
|
83
|
+
};
|
|
84
|
+
exports.safeTrim = safeTrim;
|
|
85
|
+
const splitCommas = (value) => (exports.ensureString(value)
|
|
86
|
+
.replace(/, /g, ',')
|
|
87
|
+
.split(',')
|
|
88
|
+
.reduce((_values, _value) => {
|
|
89
|
+
const __value = exports.safeTrim(_value);
|
|
90
|
+
return [
|
|
91
|
+
..._values,
|
|
92
|
+
...exports.stringNotEmpty(__value) ? [__value] : []
|
|
93
|
+
];
|
|
94
|
+
}, []));
|
|
95
|
+
exports.splitCommas = splitCommas;
|
|
96
|
+
const arrayIncludesAll = (_values, comparison) => {
|
|
97
|
+
const values = exports.ensureArray(_values);
|
|
98
|
+
return exports.ensureArray(comparison).every((value) => (exports.stringNotEmpty(value) && values.includes(value)));
|
|
99
|
+
};
|
|
100
|
+
exports.arrayIncludesAll = arrayIncludesAll;
|
|
77
101
|
//# sourceMappingURL=display.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/utils/display.js"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,+BAAmC;AAE5B,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,CAC3B,SAAM,EAAE,CACT,CAAA;AAFY,QAAA,OAAO,WAEnB;AAEM,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,CAC9B,eAAO,EAAE,CAAC,OAAO,CAAC,KAAK,EAAC,EAAE,CAAC,CAC5B,CAAA;AAFY,QAAA,UAAU,cAEtB;AAED,iCAAiC;AAC1B,MAAM,mBAAmB,GAAG,CAAC,WAAW,EAAE,EAAE;IACjD,IAAI,mBAAW,CAAC,WAAW,CAAC,EAAE;QAC5B,OAAO,EAAE,CAAA;KACV;IAED,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAA;IAClD,OAAO,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;AACtC,CAAC,CAAA;AAPY,QAAA,mBAAmB,uBAO/B;AAEM,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;AACrC,gDAAgD;AAChD,KAAK,IAAI,SAAS,IAAI,OAAO,KAAK,KAAK,IAAI,CAC5C,CAAA;AAHY,QAAA,MAAM,UAGlB;AAEM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CACtC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CACb,CAAA;AAFY,QAAA,YAAY,gBAExB;AAEM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CACtC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAC1B,CAAA;AAFY,QAAA,YAAY,gBAEx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AAO,GAAG,gBAAQ,CAAC,MAAM,CAAC,CAAA;IAChC,OAAO;QACL,GAAG,OAAO;QACV,GAAG,sBAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;KAC5C,CAAA;AACH,CAAC,EAAE,EAAE,CAAC,CACT,CAAA;AAXY,QAAA,WAAW,eAWvB;AAEM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;IACtD,MAAM,MAAM,GAAG,mBAAW,CAAC,OAAO,CAAC,CAAA;IACnC,OAAO,mBAAW,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC9C,sBAAc,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAChD,CAAC,CAAA;AACJ,CAAC,CAAA;AALY,QAAA,gBAAgB,oBAK5B"}
|
package/dist/utils/firebase.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
export class FirebaseSessionHandler {
|
|
2
|
-
static getInstance(firebaseConfig: any, collection
|
|
3
|
-
|
|
2
|
+
static getInstance(firebaseConfig: any, { collection, config }: {
|
|
3
|
+
collection: any;
|
|
4
|
+
config: any;
|
|
5
|
+
}): any;
|
|
6
|
+
constructor(enforcer: any, { config, collection }: {
|
|
7
|
+
config: any;
|
|
8
|
+
collection?: string;
|
|
9
|
+
});
|
|
4
10
|
type: string;
|
|
11
|
+
config: any;
|
|
5
12
|
collection: string;
|
|
6
13
|
get isInitialized(): boolean;
|
|
7
14
|
initializeFireStore(firebaseConfig: any): void;
|
|
8
15
|
firestore: any;
|
|
9
16
|
[singleton]: FirebaseSessionHandler;
|
|
10
17
|
}
|
|
11
|
-
export function storeCallback(
|
|
12
|
-
export function loadCallback(
|
|
13
|
-
export function deleteSessionsCallback(
|
|
14
|
-
export function findSessionsByShop(
|
|
18
|
+
export function storeCallback(instance: any, session: any): Promise<boolean>;
|
|
19
|
+
export function loadCallback(instance: any, sessionId: any): Promise<any>;
|
|
20
|
+
export function deleteSessionsCallback(instance: any, sessionIds: any): Promise<void>;
|
|
21
|
+
export function findSessionsByShop(instance: any, shop: any): Promise<any[]>;
|
|
15
22
|
declare const singleton: unique symbol;
|
|
16
23
|
export {};
|