@tiledev/sdk-shopify 0.9.0 → 0.10.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/README.md +650 -50
- package/dist/alertSettings.d.ts.map +1 -1
- package/dist/alertSettings.js +2 -0
- package/dist/alertSettings.js.map +1 -1
- package/dist/attribution.d.ts +21 -0
- package/dist/attribution.d.ts.map +1 -1
- package/dist/attribution.js +17 -0
- package/dist/attribution.js.map +1 -1
- package/dist/auth/pkce.d.ts +30 -0
- package/dist/auth/pkce.d.ts.map +1 -0
- package/dist/auth/pkce.js +128 -0
- package/dist/auth/pkce.js.map +1 -0
- package/dist/auth/session.d.ts +118 -0
- package/dist/auth/session.d.ts.map +1 -0
- package/dist/auth/session.js +896 -0
- package/dist/auth/session.js.map +1 -0
- package/dist/auth/storeCredit.d.ts +64 -0
- package/dist/auth/storeCredit.d.ts.map +1 -0
- package/dist/auth/storeCredit.js +274 -0
- package/dist/auth/storeCredit.js.map +1 -0
- package/dist/cart.d.ts +25 -1
- package/dist/cart.d.ts.map +1 -1
- package/dist/cart.js +95 -2
- package/dist/cart.js.map +1 -1
- package/dist/cartPolicy.js +4 -4
- package/dist/checkout.d.ts +123 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +205 -0
- package/dist/checkout.js.map +1 -0
- package/dist/customer.d.ts.map +1 -1
- package/dist/customer.js +8 -0
- package/dist/customer.js.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -2
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +2 -0
- package/dist/messages.js.map +1 -1
- package/dist/money.d.ts +16 -0
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +55 -0
- package/dist/money.js.map +1 -1
- package/dist/orders.d.ts +99 -0
- package/dist/orders.d.ts.map +1 -0
- package/dist/orders.js +439 -0
- package/dist/orders.js.map +1 -0
- package/dist/productPage.d.ts +100 -0
- package/dist/productPage.d.ts.map +1 -0
- package/dist/productPage.js +298 -0
- package/dist/productPage.js.map +1 -0
- package/dist/productStore.d.ts +1 -1
- package/dist/productStore.d.ts.map +1 -1
- package/dist/productStore.js +63 -5
- package/dist/productStore.js.map +1 -1
- package/dist/products.d.ts.map +1 -1
- package/dist/products.js +15 -3
- package/dist/products.js.map +1 -1
- package/dist/purchaseRules.d.ts +74 -0
- package/dist/purchaseRules.d.ts.map +1 -0
- package/dist/purchaseRules.js +73 -0
- package/dist/purchaseRules.js.map +1 -0
- package/dist/queries.d.ts +15 -13
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +43 -7
- package/dist/queries.js.map +1 -1
- package/dist/react/ShopifyProvider.d.ts +167 -25
- package/dist/react/ShopifyProvider.d.ts.map +1 -1
- package/dist/react/ShopifyProvider.js +352 -207
- package/dist/react/ShopifyProvider.js.map +1 -1
- package/dist/react/appForeground.d.ts +6 -0
- package/dist/react/appForeground.d.ts.map +1 -0
- package/dist/react/appForeground.js +19 -0
- package/dist/react/appForeground.js.map +1 -0
- package/dist/react/appForeground.native.d.ts +2 -0
- package/dist/react/appForeground.native.d.ts.map +1 -0
- package/dist/react/appForeground.native.js +23 -0
- package/dist/react/appForeground.native.js.map +1 -0
- package/dist/react/index.d.ts +7 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +23 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/tileCreditClient.d.ts +4 -0
- package/dist/react/tileCreditClient.d.ts.map +1 -0
- package/dist/react/tileCreditClient.js +27 -0
- package/dist/react/tileCreditClient.js.map +1 -0
- package/dist/react/useAppDiscountCode.d.ts +19 -0
- package/dist/react/useAppDiscountCode.d.ts.map +1 -0
- package/dist/react/useAppDiscountCode.js +44 -0
- package/dist/react/useAppDiscountCode.js.map +1 -0
- package/dist/react/useCartStoreCredit.d.ts +25 -0
- package/dist/react/useCartStoreCredit.d.ts.map +1 -0
- package/dist/react/useCartStoreCredit.js +292 -0
- package/dist/react/useCartStoreCredit.js.map +1 -0
- package/dist/react/useOrders.d.ts +104 -0
- package/dist/react/useOrders.d.ts.map +1 -0
- package/dist/react/useOrders.js +287 -0
- package/dist/react/useOrders.js.map +1 -0
- package/dist/react/useProduct.d.ts.map +1 -1
- package/dist/react/useProduct.js +1 -9
- package/dist/react/useProduct.js.map +1 -1
- package/dist/react/useProductPage.d.ts +148 -0
- package/dist/react/useProductPage.d.ts.map +1 -0
- package/dist/react/useProductPage.js +178 -0
- package/dist/react/useProductPage.js.map +1 -0
- package/dist/react/useProductRecommendations.d.ts +27 -0
- package/dist/react/useProductRecommendations.d.ts.map +1 -0
- package/dist/react/useProductRecommendations.js +76 -0
- package/dist/react/useProductRecommendations.js.map +1 -0
- package/dist/react/useStoreCredit.d.ts +58 -0
- package/dist/react/useStoreCredit.d.ts.map +1 -0
- package/dist/react/useStoreCredit.js +209 -0
- package/dist/react/useStoreCredit.js.map +1 -0
- package/dist/react/useTileCredit.d.ts +4 -3
- package/dist/react/useTileCredit.d.ts.map +1 -1
- package/dist/react/useTileCredit.js +63 -55
- package/dist/react/useTileCredit.js.map +1 -1
- package/dist/shopify.d.ts.map +1 -1
- package/dist/shopify.js +2 -0
- package/dist/shopify.js.map +1 -1
- package/dist/storedList.d.ts +27 -0
- package/dist/storedList.d.ts.map +1 -0
- package/dist/storedList.js +152 -0
- package/dist/storedList.js.map +1 -0
- package/dist/tileCredit.d.ts +25 -10
- package/dist/tileCredit.d.ts.map +1 -1
- package/dist/tileCredit.js +97 -45
- package/dist/tileCredit.js.map +1 -1
- package/dist/types.d.ts +407 -34
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -2
- package/dist/types.js.map +1 -1
- package/dist/variants.d.ts.map +1 -1
- package/dist/variants.js +4 -3
- package/dist/variants.js.map +1 -1
- package/dist/waitlist.d.ts +4 -0
- package/dist/waitlist.d.ts.map +1 -0
- package/dist/waitlist.js +213 -0
- package/dist/waitlist.js.map +1 -0
- package/dist/wishlist.d.ts.map +1 -1
- package/dist/wishlist.js +70 -47
- package/dist/wishlist.js.map +1 -1
- package/package.json +2 -2
package/dist/cart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../src/cart.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../src/cart.ts"],"names":[],"mappings":";;;AA4GA,wCASC;AAkBD,8CAGC;AAGD,wDAEC;AA0ID,4DAeC;AAxSD,qCAAkE;AAClE,uCAamB;AA4BnB;;;GAGG;AACH,SAAS,aAAa,CAAC,KAA+B,EAAE,QAAgB;;IACtE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC5D,MAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,0CAAE,MAAM,mCAAI,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,EAAE,IAAI,QAAQ,CAAC;IAC7B,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,QAAQ,CAAC;IAC1E,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,OAAO,EAAE,MAAM,EAAE,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;AACjG,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,UAAe,EAAE,QAAgB;;IACxD,MAAM,IAAI,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW,CAAC;IACrC,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ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an existing line only when the merchandise AND the
|
|
27
27
|
* line attributes match, so a per-add attribute opens a new line. Selling plans
|
|
28
|
-
* split lines too, but
|
|
29
|
-
* subscription add can look like a merge into the one-off
|
|
30
|
-
* one line low and makes the limit slightly lenient rather
|
|
31
|
-
* blocking a shopper.
|
|
28
|
+
* split lines too, but this check doesn't compare them (`line.sellingPlanId`),
|
|
29
|
+
* so a pre-order or subscription add can look like a merge into the one-off
|
|
30
|
+
* line — which counts one line low and makes the limit slightly lenient rather
|
|
31
|
+
* than falsely blocking a shopper.
|
|
32
32
|
*/
|
|
33
33
|
function mergesInto(cart, input) {
|
|
34
34
|
var _a;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shopify's hosted checkout, shown in a web view. The app can't read the checkout's page, so the page's
|
|
3
|
+
* address is the only sign it gets that an order was placed:
|
|
4
|
+
*
|
|
5
|
+
* - `isOrderPlacedUrl(url)` says whether an address is a page Shopify shows once the order is placed.
|
|
6
|
+
* - `REPORT_ADDRESS_CHANGES_SCRIPT` is the script the web view runs in every page, so the app hears about
|
|
7
|
+
* every address change, including the ones the web view itself doesn't report.
|
|
8
|
+
* - `prepareCheckout(steps, options)` gets the cart ready before checkout opens (`useCheckout().prepare`
|
|
9
|
+
* wires it to the provider; SDK move 6).
|
|
10
|
+
*
|
|
11
|
+
* No React and no network of its own (`prepareCheckout` is handed every step), the same on web, iOS and
|
|
12
|
+
* Android.
|
|
13
|
+
*/
|
|
14
|
+
import type { Cart, CartLine } from "./types";
|
|
15
|
+
/**
|
|
16
|
+
* True when the checkout's address is a page Shopify shows once the order is placed:
|
|
17
|
+
*
|
|
18
|
+
* - `/thank-you` or `/thank_you`;
|
|
19
|
+
* - `/confirmation` (one-page checkout);
|
|
20
|
+
* - the order status page: a page under `/orders/` (`/<shop id>/orders/<token>`), but never one under
|
|
21
|
+
* `/account/`. An order opened from the account menu (`/account/orders/<id>`) is an old order.
|
|
22
|
+
*
|
|
23
|
+
* Only the path is read, never the query or the fragment, and letter case doesn't matter. The same
|
|
24
|
+
* page can arrive several times (a `replaceState`, a `pushState`, late loads): report the order once
|
|
25
|
+
* per checkout.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isOrderPlacedUrl(url: string | null | undefined): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The script a checkout's web view runs in every page it loads (react-native-webview's
|
|
30
|
+
* `injectedJavaScript`). Each time the page's address changes it posts `{ kind, url }` to the app
|
|
31
|
+
* through `window.ReactNativeWebView.postMessage`, as JSON. `kind` says what changed it: `load`,
|
|
32
|
+
* `pushState`, `replaceState`, `popstate` or `hashchange`. `url` is the full address.
|
|
33
|
+
*
|
|
34
|
+
* Why it's needed: the web view's own navigation event reports whole-page loads only. A recorded
|
|
35
|
+
* checkout reached the thank-you page through `history.replaceState`, which the web view reported only
|
|
36
|
+
* as a late "finished loading", never as a new page. Wrapping the two history calls sees that change
|
|
37
|
+
* directly. A flag on the page (`__appWatchesAddress`) keeps the script from wrapping them twice. It
|
|
38
|
+
* ends in `true`, as react-native-webview asks of an injected script.
|
|
39
|
+
*
|
|
40
|
+
* From Amber's production app (where the flag was `__navProbe`).
|
|
41
|
+
*/
|
|
42
|
+
export declare const REPORT_ADDRESS_CHANGES_SCRIPT = "\n(function() {\n if (window.__appWatchesAddress) return true;\n window.__appWatchesAddress = true;\n var post = function(kind) {\n try {\n window.ReactNativeWebView.postMessage(JSON.stringify({ kind: kind, url: location.href }));\n } catch (e) {}\n };\n ['pushState', 'replaceState'].forEach(function(name) {\n var original = history[name];\n history[name] = function() {\n var result = original.apply(this, arguments);\n post(name);\n return result;\n };\n });\n window.addEventListener('popstate', function() { post('popstate'); });\n window.addEventListener('hashchange', function() { post('hashchange'); });\n post('load');\n})();\ntrue;\n";
|
|
43
|
+
/**
|
|
44
|
+
* What `prepare` found, so the app knows where to send the shopper:
|
|
45
|
+
*
|
|
46
|
+
* - `ready`: open the checkout page.
|
|
47
|
+
* - `empty`: no cart, or a cart with no lines (a reservation that ran out took them). Nothing to pay for.
|
|
48
|
+
* A read that fails isn't this: checkout goes on with the cart already loaded (see `prepareCheckout`).
|
|
49
|
+
* - `lapsedHold`: a line's reservation has run out (`hasLapsedHold`). Shopify would empty that line
|
|
50
|
+
* during checkout, so the shopper goes back to the cart, which explains it.
|
|
51
|
+
* - `failed`: something unexpected threw. The shopper stays where they are.
|
|
52
|
+
*/
|
|
53
|
+
export type CheckoutPreparation = "ready" | "empty" | "lapsedHold" | "failed";
|
|
54
|
+
export interface PrepareCheckoutOptions {
|
|
55
|
+
/**
|
|
56
|
+
* True when one of the lines has a reservation that ran out: pass Cart Hold's `hasLapsedHold`.
|
|
57
|
+
* Asked about the cart as just read. Leave it out when the app has no reservations.
|
|
58
|
+
*/
|
|
59
|
+
hasLapsedHold?: (lines: CartLine[]) => boolean;
|
|
60
|
+
}
|
|
61
|
+
/** What the buyer-identity write takes: the shopper's token, and their email and the cart's country when known. */
|
|
62
|
+
export interface CheckoutShopper {
|
|
63
|
+
customerAccessToken: string;
|
|
64
|
+
email?: string;
|
|
65
|
+
countryCode?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Every step `prepareCheckout` takes, handed in, so the rule is tested without React or a network.
|
|
69
|
+
* `useCheckout().prepare` hands in the provider's own.
|
|
70
|
+
*/
|
|
71
|
+
export interface CheckoutPreparationSteps {
|
|
72
|
+
/** Reads the cart again (`useCart().refresh`). Null when there is no cart. May reject (offline). */
|
|
73
|
+
readCartAgain: () => Promise<Cart | null>;
|
|
74
|
+
/** The cart as the app already has it (`useCart().cart`), for when reading it again fails. */
|
|
75
|
+
cartAlreadyLoaded: () => Cart | null;
|
|
76
|
+
/** A shopper is signed in (`useCustomer().loggedIn`). */
|
|
77
|
+
signedIn: boolean;
|
|
78
|
+
/** The signed-in shopper's email, when their profile has loaded. */
|
|
79
|
+
email: string | null;
|
|
80
|
+
/** A usable access token for the signed-in shopper (`useCustomer().getAccessToken`). */
|
|
81
|
+
getAccessToken: () => Promise<string | null>;
|
|
82
|
+
/** Attaches the shopper to the cart (`useCart().setBuyerIdentity`). */
|
|
83
|
+
setBuyerIdentity: (shopper: CheckoutShopper) => Promise<boolean>;
|
|
84
|
+
/** Marks the cart as gone to checkout (`useCheckout().reportCheckoutStarted`). */
|
|
85
|
+
reportCheckoutStarted: () => Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Lands the cart's `_apptile_attribution` (`useCart().flushAttribution`). Left out, the step is
|
|
88
|
+
* skipped. True when the cart holds the device's value.
|
|
89
|
+
*/
|
|
90
|
+
flushAttribution?: () => Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Makes sure the cart carries the provider's `cartAttributes` (`useCart().ensureCartAttributes`).
|
|
93
|
+
* Left out, the step is skipped. True when it does.
|
|
94
|
+
*/
|
|
95
|
+
ensureCartAttributes?: () => Promise<boolean>;
|
|
96
|
+
/** How long each labelling step may take, in ms. Default `CHECKOUT_LABEL_STEP_TIMEOUT_MS`. */
|
|
97
|
+
labelStepTimeoutMs?: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* How long each step that labels the cart may take before checkout goes on without it: long enough
|
|
101
|
+
* for one queued write and its retry on a phone network (Freckled Poppy's 3 seconds). A slow write
|
|
102
|
+
* still lands later, in the cart's write queue.
|
|
103
|
+
*/
|
|
104
|
+
export declare const CHECKOUT_LABEL_STEP_TIMEOUT_MS = 3000;
|
|
105
|
+
/**
|
|
106
|
+
* Gets the cart ready for checkout, in this order:
|
|
107
|
+
*
|
|
108
|
+
* 1. **The cart is read again**: a reservation that ran out may already have taken a line. No cart,
|
|
109
|
+
* or no lines, is `empty`. **A read that fails carries on** with the cart already loaded
|
|
110
|
+
* (`cartAlreadyLoaded`), as Freckled Poppy did: Shopify's checkout checks the cart again itself.
|
|
111
|
+
* Decided 2026-10-06 by the Head of Engineering: "Carry on". Until then a failed read (offline)
|
|
112
|
+
* counted as no cart, and amore-v2 told the shopper their reservation had run out.
|
|
113
|
+
* 2. **A lapsed reservation** (`options.hasLapsedHold`) is `lapsedHold`, and nothing else happens.
|
|
114
|
+
* 3. **Together:** the signed-in shopper is attached (`attachShopper`), and the cart is labelled
|
|
115
|
+
* (`labelCart`). Neither can stop checkout.
|
|
116
|
+
* 4. **The start is reported** (`reportCheckoutStarted`): a cart gone to checkout reads back empty like
|
|
117
|
+
* an expired one, so this keeps the next launch from refilling it.
|
|
118
|
+
* 5. `ready`.
|
|
119
|
+
*
|
|
120
|
+
* Anything else that throws is `failed`. Never rejects. Going to the checkout page is the app's.
|
|
121
|
+
*/
|
|
122
|
+
export declare function prepareCheckout(steps: CheckoutPreparationSteps, options?: PrepareCheckoutOptions): Promise<CheckoutPreparation>;
|
|
123
|
+
//# sourceMappingURL=checkout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../src/checkout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA+C9C;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAKxE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,6BAA6B,qrBAsBzC,CAAC;AAMF;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE9E,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC;CAChD;AAED,mHAAmH;AACnH,MAAM,WAAW,eAAe;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,oGAAoG;IACpG,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAC1C,8FAA8F;IAC9F,iBAAiB,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACrC,yDAAyD;IACzD,QAAQ,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,wFAAwF;IACxF,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,uEAAuE;IACvE,gBAAgB,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,kFAAkF;IAClF,qBAAqB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,OAAO,CAAC;AAyDnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,wBAAwB,EAC/B,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,CAgB9B"}
|
package/dist/checkout.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHECKOUT_LABEL_STEP_TIMEOUT_MS = exports.REPORT_ADDRESS_CHANGES_SCRIPT = void 0;
|
|
4
|
+
exports.isOrderPlacedUrl = isOrderPlacedUrl;
|
|
5
|
+
exports.prepareCheckout = prepareCheckout;
|
|
6
|
+
/**
|
|
7
|
+
* The thank-you page, as a whole part of the path: `thank-you` (today's checkout,
|
|
8
|
+
* `/checkouts/cn/<token>/thank-you`) or `thank_you` (the older one,
|
|
9
|
+
* `/<shop id>/checkouts/<token>/thank_you`). A part that only starts with it, such as
|
|
10
|
+
* `/pages/thank-you-for-subscribing`, doesn't count.
|
|
11
|
+
*/
|
|
12
|
+
const THANK_YOU_PAGE = /\/thank[-_]you(?:\/|$)/i;
|
|
13
|
+
/**
|
|
14
|
+
* Where one-page checkout lands: `/checkouts/cn/<token>/confirmation`. Missing it once lost a real order
|
|
15
|
+
* (Freckled Poppy, 2026): the payment went through, Shopify moved to `/confirmation`, and the app saw
|
|
16
|
+
* nothing.
|
|
17
|
+
*/
|
|
18
|
+
const CONFIRMATION_PAGE = /\/confirmation(?:\/|$)/i;
|
|
19
|
+
/**
|
|
20
|
+
* A page under `/orders/`, such as the order status page `/<shop id>/orders/<token>`.
|
|
21
|
+
*
|
|
22
|
+
* No `g` (global) flag on purpose. A global regex remembers where its last match ended (`lastIndex`)
|
|
23
|
+
* and starts the next `.test` from there, so asking twice about the same address can answer `true`
|
|
24
|
+
* and then `false`. A regex without the flag starts from the beginning every time.
|
|
25
|
+
*/
|
|
26
|
+
const ORDER_PAGE = /\/orders\//i;
|
|
27
|
+
/**
|
|
28
|
+
* An order opened from the shopper's account: `account` comes before `orders` in the path, as in
|
|
29
|
+
* `/account/orders/<id>` or `/<shop id>/account/orders/<id>`. A signed-in checkout shows an account
|
|
30
|
+
* menu that links there, and that order was placed long ago. Counting it would send `purchase` and
|
|
31
|
+
* clear the cart the moment a shopper looked at a past order (production did this once, when it
|
|
32
|
+
* matched `/orders`). Decided 2026-10-06, Head of Engineering: "Skip /account/orders/".
|
|
33
|
+
*/
|
|
34
|
+
const ACCOUNT_ORDER_PAGE = /\/account\/(?:.+\/)?orders\//i;
|
|
35
|
+
/**
|
|
36
|
+
* The part of an address that names the page: after the host, before the query (`?…`) and the
|
|
37
|
+
* fragment (`#…`). A query can carry another page's address (`?return_to=/orders/12`), and that must
|
|
38
|
+
* never count.
|
|
39
|
+
*/
|
|
40
|
+
function pathOf(url) {
|
|
41
|
+
const beforeQuery = url.split(/[?#]/)[0];
|
|
42
|
+
// Drop `https://host` (or a bare `//host`), so a host can never look like part of the path.
|
|
43
|
+
return beforeQuery.replace(/^(?:[a-z][a-z0-9+.-]*:)?\/\/[^/]*/i, "");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* True when the checkout's address is a page Shopify shows once the order is placed:
|
|
47
|
+
*
|
|
48
|
+
* - `/thank-you` or `/thank_you`;
|
|
49
|
+
* - `/confirmation` (one-page checkout);
|
|
50
|
+
* - the order status page: a page under `/orders/` (`/<shop id>/orders/<token>`), but never one under
|
|
51
|
+
* `/account/`. An order opened from the account menu (`/account/orders/<id>`) is an old order.
|
|
52
|
+
*
|
|
53
|
+
* Only the path is read, never the query or the fragment, and letter case doesn't matter. The same
|
|
54
|
+
* page can arrive several times (a `replaceState`, a `pushState`, late loads): report the order once
|
|
55
|
+
* per checkout.
|
|
56
|
+
*/
|
|
57
|
+
function isOrderPlacedUrl(url) {
|
|
58
|
+
if (typeof url !== "string" || url === "")
|
|
59
|
+
return false;
|
|
60
|
+
const path = pathOf(url);
|
|
61
|
+
const isOrderStatusPage = ORDER_PAGE.test(path) && !ACCOUNT_ORDER_PAGE.test(path);
|
|
62
|
+
return THANK_YOU_PAGE.test(path) || CONFIRMATION_PAGE.test(path) || isOrderStatusPage;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The script a checkout's web view runs in every page it loads (react-native-webview's
|
|
66
|
+
* `injectedJavaScript`). Each time the page's address changes it posts `{ kind, url }` to the app
|
|
67
|
+
* through `window.ReactNativeWebView.postMessage`, as JSON. `kind` says what changed it: `load`,
|
|
68
|
+
* `pushState`, `replaceState`, `popstate` or `hashchange`. `url` is the full address.
|
|
69
|
+
*
|
|
70
|
+
* Why it's needed: the web view's own navigation event reports whole-page loads only. A recorded
|
|
71
|
+
* checkout reached the thank-you page through `history.replaceState`, which the web view reported only
|
|
72
|
+
* as a late "finished loading", never as a new page. Wrapping the two history calls sees that change
|
|
73
|
+
* directly. A flag on the page (`__appWatchesAddress`) keeps the script from wrapping them twice. It
|
|
74
|
+
* ends in `true`, as react-native-webview asks of an injected script.
|
|
75
|
+
*
|
|
76
|
+
* From Amber's production app (where the flag was `__navProbe`).
|
|
77
|
+
*/
|
|
78
|
+
exports.REPORT_ADDRESS_CHANGES_SCRIPT = `
|
|
79
|
+
(function() {
|
|
80
|
+
if (window.__appWatchesAddress) return true;
|
|
81
|
+
window.__appWatchesAddress = true;
|
|
82
|
+
var post = function(kind) {
|
|
83
|
+
try {
|
|
84
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ kind: kind, url: location.href }));
|
|
85
|
+
} catch (e) {}
|
|
86
|
+
};
|
|
87
|
+
['pushState', 'replaceState'].forEach(function(name) {
|
|
88
|
+
var original = history[name];
|
|
89
|
+
history[name] = function() {
|
|
90
|
+
var result = original.apply(this, arguments);
|
|
91
|
+
post(name);
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
window.addEventListener('popstate', function() { post('popstate'); });
|
|
96
|
+
window.addEventListener('hashchange', function() { post('hashchange'); });
|
|
97
|
+
post('load');
|
|
98
|
+
})();
|
|
99
|
+
true;
|
|
100
|
+
`;
|
|
101
|
+
/**
|
|
102
|
+
* How long each step that labels the cart may take before checkout goes on without it: long enough
|
|
103
|
+
* for one queued write and its retry on a phone network (Freckled Poppy's 3 seconds). A slow write
|
|
104
|
+
* still lands later, in the cart's write queue.
|
|
105
|
+
*/
|
|
106
|
+
exports.CHECKOUT_LABEL_STEP_TIMEOUT_MS = 3000;
|
|
107
|
+
/** The work's answer, or `"timeout"` once `ms` have passed. Never rejects: a rejection is `false`. */
|
|
108
|
+
async function withinTime(work, ms) {
|
|
109
|
+
let timer;
|
|
110
|
+
const timedOut = new Promise((resolve) => {
|
|
111
|
+
timer = setTimeout(() => resolve("timeout"), ms);
|
|
112
|
+
});
|
|
113
|
+
try {
|
|
114
|
+
return await Promise.race([work().catch(() => false), timedOut]);
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
clearTimeout(timer);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Attaches the signed-in shopper, so checkout is theirs, with their saved details. The cart's country
|
|
122
|
+
* is sent again with them: the write replaces the whole buyer identity, and a gift card (store credit)
|
|
123
|
+
* stays only on a cart with a country. Any failure leaves a guest checkout. Signed out, nothing.
|
|
124
|
+
*/
|
|
125
|
+
async function attachShopper(steps, cart) {
|
|
126
|
+
var _a, _b;
|
|
127
|
+
if (!steps.signedIn)
|
|
128
|
+
return;
|
|
129
|
+
try {
|
|
130
|
+
const token = await steps.getAccessToken();
|
|
131
|
+
if (!token)
|
|
132
|
+
return;
|
|
133
|
+
const countryCode = (_b = (_a = cart.buyerIdentity) === null || _a === void 0 ? void 0 : _a.countryCode) !== null && _b !== void 0 ? _b : null;
|
|
134
|
+
await steps.setBuyerIdentity({
|
|
135
|
+
customerAccessToken: token,
|
|
136
|
+
...(steps.email ? { email: steps.email } : {}),
|
|
137
|
+
...(countryCode ? { countryCode } : {}),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// A guest checkout it is.
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Labels the cart for what happens after the order (Freckled Poppy's `labelCartForCheckout`): first
|
|
146
|
+
* the cart's `_apptile_attribution` lands, then the provider's `cartAttributes` are made sure of. One
|
|
147
|
+
* after the other, as both write the cart's attributes. A step that fails or runs past its time is
|
|
148
|
+
* warned about, and checkout goes on.
|
|
149
|
+
*/
|
|
150
|
+
async function labelCart(steps) {
|
|
151
|
+
var _a;
|
|
152
|
+
const ms = (_a = steps.labelStepTimeoutMs) !== null && _a !== void 0 ? _a : exports.CHECKOUT_LABEL_STEP_TIMEOUT_MS;
|
|
153
|
+
const labelSteps = [
|
|
154
|
+
["flushAttribution", steps.flushAttribution],
|
|
155
|
+
["ensureCartAttributes", steps.ensureCartAttributes],
|
|
156
|
+
];
|
|
157
|
+
for (const [name, step] of labelSteps) {
|
|
158
|
+
if (!step)
|
|
159
|
+
continue;
|
|
160
|
+
const outcome = await withinTime(step, ms);
|
|
161
|
+
if (outcome !== true) {
|
|
162
|
+
console.warn(`[sdk-shopify] checkout: ${name} ${outcome === "timeout" ? "timed out" : "failed"}; checkout goes on`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Gets the cart ready for checkout, in this order:
|
|
168
|
+
*
|
|
169
|
+
* 1. **The cart is read again**: a reservation that ran out may already have taken a line. No cart,
|
|
170
|
+
* or no lines, is `empty`. **A read that fails carries on** with the cart already loaded
|
|
171
|
+
* (`cartAlreadyLoaded`), as Freckled Poppy did: Shopify's checkout checks the cart again itself.
|
|
172
|
+
* Decided 2026-10-06 by the Head of Engineering: "Carry on". Until then a failed read (offline)
|
|
173
|
+
* counted as no cart, and amore-v2 told the shopper their reservation had run out.
|
|
174
|
+
* 2. **A lapsed reservation** (`options.hasLapsedHold`) is `lapsedHold`, and nothing else happens.
|
|
175
|
+
* 3. **Together:** the signed-in shopper is attached (`attachShopper`), and the cart is labelled
|
|
176
|
+
* (`labelCart`). Neither can stop checkout.
|
|
177
|
+
* 4. **The start is reported** (`reportCheckoutStarted`): a cart gone to checkout reads back empty like
|
|
178
|
+
* an expired one, so this keeps the next launch from refilling it.
|
|
179
|
+
* 5. `ready`.
|
|
180
|
+
*
|
|
181
|
+
* Anything else that throws is `failed`. Never rejects. Going to the checkout page is the app's.
|
|
182
|
+
*/
|
|
183
|
+
async function prepareCheckout(steps, options = {}) {
|
|
184
|
+
var _a;
|
|
185
|
+
try {
|
|
186
|
+
const cart = await steps.readCartAgain().catch(() => steps.cartAlreadyLoaded());
|
|
187
|
+
if (!cart || cart.lines.length === 0)
|
|
188
|
+
return "empty";
|
|
189
|
+
if ((_a = options.hasLapsedHold) === null || _a === void 0 ? void 0 : _a.call(options, cart.lines))
|
|
190
|
+
return "lapsedHold";
|
|
191
|
+
await Promise.all([attachShopper(steps, cart), labelCart(steps)]);
|
|
192
|
+
try {
|
|
193
|
+
await steps.reportCheckoutStarted();
|
|
194
|
+
}
|
|
195
|
+
catch (reportError) {
|
|
196
|
+
console.warn("[sdk-shopify] checkout: reportCheckoutStarted failed; checkout goes on", reportError);
|
|
197
|
+
}
|
|
198
|
+
return "ready";
|
|
199
|
+
}
|
|
200
|
+
catch (unexpected) {
|
|
201
|
+
console.warn("[sdk-shopify] checkout: getting the cart ready failed", unexpected);
|
|
202
|
+
return "failed";
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=checkout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../src/checkout.ts"],"names":[],"mappings":";;;AAwEA,4CAKC;AAuLD,0CAmBC;AAvQD;;;;;GAKG;AACH,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG,+BAA+B,CAAC;AAE3D;;;;GAIG;AACH,SAAS,MAAM,CAAC,GAAW;IACzB,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,4FAA4F;IAC5F,OAAO,WAAW,CAAC,OAAO,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;AACvE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,gBAAgB,CAAC,GAA8B;IAC7D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK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AAG,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,OAAO,CAAC;QACrD,IAAI,MAAA,OAAO,CAAC,aAAa,wDAAG,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,YAAY,CAAC;QAC7D,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClE,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,qBAAqB,EAAE,CAAC;QACtC,CAAC;QAAC,OAAO,WAAW,EAAE,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,wEAAwE,EAAE,WAAW,CAAC,CAAC;QACtG,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,UAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,uDAAuD,EAAE,UAAU,CAAC,CAAC;QAClF,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/customer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../src/customer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../src/customer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAOV,kBAAkB,EAGnB,MAAM,SAAS,CAAC;AAsDjB,eAAO,MAAM,QAAQ,EAAE,kBAmGtB,CAAC"}
|
package/dist/customer.js
CHANGED
|
@@ -64,6 +64,14 @@ exports.customer = {
|
|
|
64
64
|
}
|
|
65
65
|
return data.customerAccessTokenCreate.customerAccessToken;
|
|
66
66
|
},
|
|
67
|
+
async renew(accessToken) {
|
|
68
|
+
const data = await (0, client_1.request)(queries_1.CUSTOMER_ACCESS_TOKEN_RENEW_MUTATION, { customerAccessToken: accessToken });
|
|
69
|
+
(0, client_1.assertNoUserErrors)('customerAccessTokenRenew', data.customerAccessTokenRenew.userErrors);
|
|
70
|
+
if (!data.customerAccessTokenRenew.customerAccessToken) {
|
|
71
|
+
throw new Error('customerAccessTokenRenew returned no token');
|
|
72
|
+
}
|
|
73
|
+
return data.customerAccessTokenRenew.customerAccessToken;
|
|
74
|
+
},
|
|
67
75
|
async logout(accessToken) {
|
|
68
76
|
var _a;
|
|
69
77
|
const data = await (0, client_1.request)(queries_1.CUSTOMER_ACCESS_TOKEN_DELETE_MUTATION, {
|
package/dist/customer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../src/customer.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../src/customer.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AACvD,uCASmB;AAqCnB,SAAS,cAAc,CAAC,CAAM;;IAC5B,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,iBAAiB,EAAE,MAAA,CAAC,CAAC,iBAAiB,mCAAI,IAAI;QAC9C,eAAe,EAAE,MAAA,CAAC,CAAC,eAAe,mCAAI,IAAI;QAC1C,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,KAAK,EAAE,MAAA,CAAC,CAAC,KAAK,mCAAI,IAAI;QACtB,KAAK,EAAE,MAAA,CAAC,CAAC,KAAK,mCAAI,IAAI;QACtB,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,aAAa,EAAE,MAAA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CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,mCAAI,IAAI,CAAC;IAC1D,CAAC;CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
export { shopify, shopify as default } from './shopify';
|
|
2
|
-
export { formatMoney, applyMoneyFormat, shop } from './money';
|
|
2
|
+
export { formatMoney, applyMoneyFormat, shop, typedAmountToCents } from './money';
|
|
3
3
|
export { getMoneyFormat, getCurrencyCode } from './client';
|
|
4
4
|
export { clearRequestCache, DEFAULT_CACHE_TTL_MS, type RequestCacheOptions } from './requestCache';
|
|
5
5
|
export { PRODUCT_BASE_KEYS, peekProduct, forgetProduct, clearProductStore, toProductBase, type ProductBase, type CachedProduct, } from './productStore';
|
|
6
6
|
export { toLineSnapshot } from './cart';
|
|
7
|
-
export {
|
|
7
|
+
export { isOrderPlacedUrl, REPORT_ADDRESS_CHANGES_SCRIPT, CHECKOUT_LABEL_STEP_TIMEOUT_MS, type CheckoutPreparation, type PrepareCheckoutOptions, } from './checkout';
|
|
8
|
+
export { ORDER_CLOCK_LEEWAY_MS } from './orders';
|
|
9
|
+
export { preorderPlanFor, purchaseModeFor, waitlistActionFor, type PreorderVariant, type PreorderOptions, type PurchaseMode, type PurchaseModeInput, type WaitlistAction, } from './purchaseRules';
|
|
10
|
+
export { DEFAULT_OPTION_ORDER, DEFAULT_LOW_STOCK_THRESHOLD, isPlaceholderOption, selectableOptions, findVariant, initialSelection, selectionForVariant, isVariantUnavailable, optionStates, selectionLabel, variantPrice, isLowStock, stockCeiling, quantityInCart, withinCeiling, initialMediaIndex, firstImageUrl, sizedImageUrl, parseDescriptionHtml, productShareUrl, type ProductLike, type OptionSelection, type SelectableOptionsConfig, type OptionValueState, type OptionState, type VariantPrice, type DescriptionSpan, type DescriptionBlock, } from './productPage';
|
|
11
|
+
export { ATTRIBUTION_ATTRIBUTE_KEY, parseAttribution, serializeAttribution, recordAdd, recordRemove, mergeAttribution, showsInCart, type ShowsInCart, type Attribution, type AttributionCounts, type AttributionShow, type AttributionSource, type AttributionLineType, } from './attribution';
|
|
8
12
|
export { priceRange, priceFilterInput, parsePriceFilterInput, isPriceFilterInput, type PriceRange, } from './filters';
|
|
9
13
|
export { DEFAULT_MESSAGES, message, getMessages, setMessages, patchMessages, setMessageResolver, limitExceededMessage, } from './messages';
|
|
10
14
|
export { setCartPolicy, getCartPolicy, maxLineItems, projectedLineCount, wouldExceedLineLimit, } from './cartPolicy';
|
|
11
15
|
export { ALERT_SETTINGS_PATH, MAX_LINE_ITEMS_SETTING_PATH, ALERT_SETTING_FIELDS, MAX_ALERT_LENGTH, MAX_LINE_ITEMS_RANGE, readAlertSettings, readCartPolicy, isAlertSilenced, type AlertSettings, } from './alertSettings';
|
|
12
16
|
export { classifyAuthFailure, isOutOfStockError, isUserErrorRejection, userErrorsOf, } from './errors';
|
|
13
|
-
export {
|
|
17
|
+
export { giftCardsEndingIn, giftCardCodesNotOnCart } from './cart';
|
|
18
|
+
export { TileCreditClient, DEFAULT_TILE_CREDIT_BASE_URL, configureTileCredit, getTileCreditClient, redeemAndApplyToCart, centsToMoney, moneyToCents, } from './tileCredit';
|
|
14
19
|
export { setProductMetafields, getProductMetafields, productMetafield, } from './metafields';
|
|
15
20
|
export { TileCreditError } from './types';
|
|
21
|
+
export { createCustomerSession, customerAccountUrls, SHOPIFY_SESSION_KEYS, PASSWORD_SESSION_KEYS, LEGACY_PASSWORD_TOKEN_KEY, type CustomerSession, type SessionState, type SignupInput, type ProfileChanges, type AuthEventType, } from './auth/session';
|
|
22
|
+
export { sumStoreCredit, STORE_CREDIT_QUERY, STORE_CREDIT_HISTORY_QUERY, STORE_CREDIT_HISTORY_PAGE_SIZE, storeCreditHistoryNextQuery, tileCreditEntry, tileCreditHistory, shopifyStoreCreditHistory, type StoreCreditHistoryPage, type StoreCreditHistorySource, } from './auth/storeCredit';
|
|
23
|
+
export { codeChallenge, createPkce } from './auth/pkce';
|
|
16
24
|
export type * from './types';
|
|
17
|
-
export { ShopifyProvider, useShopify, useCart, useWishlist, useCustomer, useCheckout, useShopifyMessage, useTileCredit, useCollectionProducts, COLLECTION_PAGE_SIZE, useSearch, SEARCH_PAGE_SIZE, SEARCH_DEBOUNCE_MS, useProduct, REVALIDATE_AFTER_MS, useAlertSettings, type ShopifyProviderProps, type ShopifyEvent, type ShopifyEventType, type CartState, type WishlistState, type CustomerState, type CheckoutState, type UseTileCreditOptions, type UseTileCreditState, type CollectionSort, type UseCollectionProductsOptions, type CollectionProductsState, type UseCollectionProductsResult, type SearchSort, type UseSearchOptions, type UseSearchResult, type SearchState, type UseProductOptions, type UseProductState, type UseProductResult, type ProductFeedState, type ProductFeedResult, type UseAlertSettingsOptions, type AlertSettingsProps, } from './react';
|
|
25
|
+
export { ShopifyProvider, useShopify, useCart, useWishlist, useWaitlist, useCustomer, useCheckout, useShopifyMessage, useShopifyEvents, useTileCredit, useCollectionProducts, COLLECTION_PAGE_SIZE, useSearch, SEARCH_PAGE_SIZE, SEARCH_DEBOUNCE_MS, useProduct, REVALIDATE_AFTER_MS, useAlertSettings, useVariantSelection, useAddToCart, useProductPage, useProductRecommendations, DEFAULT_RECOMMENDATION_LIMIT, useStoreCredit, type StoreCreditState, useCartStoreCredit, type CartStoreCreditState, useStoreCreditHistory, type StoreCreditHistoryState, type UseStoreCreditHistoryOptions, useOrders, useOrder, useLatestOrderSince, ORDERS_PAGE_SIZE, LATEST_ORDER_READ_AGAIN_SECONDS, type UseOrdersOptions, type OrdersState, type OrderState, type BuyAgainResult, type UseLatestOrderSinceOptions, type LatestOrderSince, useAppDiscountCode, type UseAppDiscountCodeOptions, type ShopifyProviderProps, type ShopifyEvent, type ShopifyEventType, type CartLineChange, type CartState, type WishlistState, type WaitlistState, type CustomerState, type CheckoutState, type UseTileCreditOptions, type UseTileCreditState, type CollectionSort, type UseCollectionProductsOptions, type CollectionProductsState, type UseCollectionProductsResult, type SearchSort, type UseSearchOptions, type UseSearchResult, type SearchState, type UseProductOptions, type UseProductState, type UseProductResult, type ProductFeedState, type ProductFeedResult, type UseAlertSettingsOptions, type AlertSettingsProps, type UseVariantSelectionOptions, type VariantSelection, type AddToCartReason, type AddToCartResult, type AddToCartInput, type UseAddToCartOptions, type AddToCart, type UseProductPageOptions, type ProductPageStatus, type ProductPage, type UseProductRecommendationsOptions, type ProductRecommendations, } from './react';
|
|
18
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,8BAA8B,EAC9B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,GAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qB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